Skip to content

Commit

Permalink
fix: debug mode information
Browse files Browse the repository at this point in the history
  • Loading branch information
unimu-cic committed Feb 18, 2024
1 parent c694b29 commit ccd4b1c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/components/DiagramFrame/Debug/Debug.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<script>
import Icon from "@/components/Icon/Icon.vue";
const commitHash = "process.env.VUE_APP_GIT_HASH";
const gitBranch = "process.env.VUE_APP_GIT_BRANCH";
const commitHash = import.meta.env.VITE_APP_GIT_HASH;
const gitBranch = import.meta.env.VITE_APP_GIT_BRANCH;
export default {
name: "Debug",
components: { Icon },
Expand Down
34 changes: 21 additions & 13 deletions vite.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,21 @@
import { resolve } from 'path';
import { defineConfig } from 'vite';
import createVuePlugin from '@vitejs/plugin-vue';
import { execSync } from 'child_process';
import svgLoader from 'vite-svg-loader';
import { resolve } from "path";
import { defineConfig } from "vite";
import createVuePlugin from "@vitejs/plugin-vue";
import { execSync } from "child_process";
import svgLoader from "vite-svg-loader";

process.env.VITE_APP_GIT_HASH = execSync("git rev-parse --short HEAD")
.toString()
.trim();
process.env.VITE_APP_GIT_BRANCH = execSync("git branch --show-current")
.toString()
.trim();

function getCypressHtmlFiles() {
const cypressFolder = resolve(__dirname, 'cy');
const strings = execSync(`find ${cypressFolder} -name '*.html'`).toString().split('\n');
const cypressFolder = resolve(__dirname, "cy");
const strings = execSync(`find ${cypressFolder} -name '*.html'`)

Check warning

Code scanning / CodeQL

Shell command built from environment values Medium

This shell command depends on an uncontrolled
absolute path
.
.toString()
.split("\n");
// remove empty string
strings.pop();
return strings;
Expand All @@ -17,13 +26,13 @@ console.log(cypressHtmlFiles);
export default defineConfig({
build: {
rollupOptions: {
input: ['index.html', 'embed.html', ...cypressHtmlFiles],
input: ["index.html", "embed.html", ...cypressHtmlFiles],
},
},
resolve: {
alias: {
'vue': '@vue/compat',
'@': resolve(__dirname, './src')
vue: "@vue/compat",
"@": resolve(__dirname, "./src"),
},
},
plugins: [
Expand All @@ -39,11 +48,10 @@ export default defineConfig({
svgLoader(),
],
test: {
environment: 'jsdom',
environment: "jsdom",
globals: true,
deps: {
inline: ['@vue/test-utils'],
inline: ["@vue/test-utils"],
},
},
});

0 comments on commit ccd4b1c

Please sign in to comment.