update navbar, fix versioning

This commit is contained in:
2026-06-06 10:43:30 +05:30
parent 4f70c77874
commit 09565b75b9
2 changed files with 299 additions and 300 deletions

View File

@@ -1,10 +1,33 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import { execSync } from 'child_process'
// Derive version from git tags; fall back to commit hash
function getGitVersion() {
try {
// If there's a tag pointing at HEAD, use it exactly (e.g. "v1.2.0")
// Otherwise use "v0.0.0-<hash>[-dirty]"
const raw = execSync('git describe --tags --always --dirty', { stdio: ['pipe', 'pipe', 'ignore'] })
.toString()
.trim();
// If it looks like a pure tag (no dashes after the tag part) return as-is
return raw;
} catch {
return 'dev';
}
}
const APP_VERSION = getGitVersion();
console.log(`[vite] App version: ${APP_VERSION}`);
// https://vite.dev/config/
export default defineConfig({
plugins: [react(), tailwindcss()],
define: {
// Injected at build time — available as __APP_VERSION__ in source
__APP_VERSION__: JSON.stringify(APP_VERSION),
},
server: {
proxy: {
'/api': {