Add __commit_hash_ vite define

This commit is contained in:
Matthias 2024-03-10 20:29:40 +01:00
parent e2eff62f29
commit 8bc5047d60
2 changed files with 8 additions and 0 deletions

2
src/env.d.ts vendored
View File

@ -10,3 +10,5 @@ interface ImportMetaEnv extends Readonly<Record<string, string>> {
interface ImportMeta {
readonly env: ImportMetaEnv;
}
declare const __COMMIT_HASH__: string;

View File

@ -6,9 +6,15 @@ import Components from 'unplugin-vue-components/vite';
import IconsResolve from 'unplugin-icons/resolver';
import AutoImport from 'unplugin-auto-import/vite';
import { BootstrapVueNextResolver } from 'unplugin-vue-components/resolvers';
import { execSync } from 'child_process';
const commitHash = execSync('git rev-parse --short HEAD').toString();
// https://vitejs.dev/config/
export default defineConfig({
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
},
plugins: [
createVuePlugin({
script: {