From 59846fc1e44806eaa86272eca1a77d6468bc5c4d Mon Sep 17 00:00:00 2001 From: hobokenchicken Date: Mon, 6 Jul 2026 12:52:20 +0000 Subject: [PATCH] chore(build): automatically embed git commit hash in version string --- web/vite.config.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/web/vite.config.ts b/web/vite.config.ts index c006871..01332fe 100644 --- a/web/vite.config.ts +++ b/web/vite.config.ts @@ -1,7 +1,15 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' +import { execSync } from 'child_process' -const gitSha = process.env.GIT_SHA || 'dev' +let gitSha = process.env.GIT_SHA +if (!gitSha) { + try { + gitSha = execSync('git rev-parse --short HEAD').toString().trim() + } catch (e) { + gitSha = 'dev' + } +} // https://vite.dev/config/ export default defineConfig({