build info on bottom left of screen area

This commit is contained in:
Carter 2026-05-22 11:09:18 -06:00
parent 08b3db1cd9
commit 312cc6e2dc
3 changed files with 41 additions and 3 deletions

View file

@ -5,6 +5,7 @@ import { VitePWA } from 'vite-plugin-pwa';
import * as path from 'path' // ✅ Import path module
import { readFileSync, renameSync, existsSync, unlinkSync } from 'node:fs'
import { fileURLToPath } from 'node:url'
import { execSync } from 'node:child_process'
const rootDir = path.dirname(fileURLToPath(import.meta.url))
@ -49,7 +50,19 @@ function emitLocalnetShellAsIndexHtml (mode: string): Plugin {
// https://vitejs.dev/config/
export default defineConfig(({ command, mode }): UserConfig => {
const useLocalnetShell = mode === LOCALNET_MODE
let gitHash = 'unknown'
try {
gitHash = execSync('git rev-parse --short HEAD').toString().trim()
} catch {}
const buildDate = new Date().toISOString()
return {
define: {
__BUILD_DATE__: JSON.stringify(buildDate),
__GIT_HASH__: JSON.stringify(gitHash),
},
plugins: [
useLocalnetShellHtml(mode, command),
emitLocalnetShellAsIndexHtml(mode),