diff --git a/src/components/AppFooter.vue b/src/components/AppFooter.vue index 8c3f2be..222aed8 100644 --- a/src/components/AppFooter.vue +++ b/src/components/AppFooter.vue @@ -4,7 +4,7 @@ height="40" >
- StudSpider 0.2 (5288d) + StudSpider 0.2 ({{ gitHash }})
import { computed } from 'vue' +const gitHash = __GIT_COMMIT_HASH__ + const copyrightYear = computed(() => { const currentYear = new Date().getFullYear() const startYear = 2025 diff --git a/vite.config.mjs b/vite.config.mjs index 42147dd..5cdddc1 100644 --- a/vite.config.mjs +++ b/vite.config.mjs @@ -11,9 +11,23 @@ import Vuetify, { transformAssetUrls } from 'vite-plugin-vuetify' // Utilities import { defineConfig } from 'vite' import { fileURLToPath, URL } from 'node:url' +import { execSync } from 'child_process' + +// Get git commit hash +const getGitHash = () => { + try { + return execSync('git rev-parse --short HEAD').toString().trim() + } catch (e) { + return 'unknown' + } +} // https://vitejs.dev/config/ export default defineConfig({ + define: { + '__GIT_COMMIT_HASH__': JSON.stringify(getGitHash()), + 'process.env': {} + }, plugins: [ VueRouter(), Layouts(), @@ -59,7 +73,6 @@ export default defineConfig({ 'unplugin-vue-router/data-loaders/basic', ], }, - define: { 'process.env': {} }, resolve: { alias: { '@': fileURLToPath(new URL('src', import.meta.url)),