Add CalVer to Settings

This commit is contained in:
Alex Gleason committed 2025-10-22 18:37:27 -05:00
1 parent 9c3b0d2100
commit ee78156071
3 files changed
+25

No files matched your search

+6
View File
@@ -128,6 +128,12 @@ export function AboutSettings() {
</AccordionItem>
</Accordion>
</div>
{import.meta.env.VERSION && (
<div className="text-center text-xs text-muted-foreground/60 pt-4">
v{import.meta.env.VERSION}
</div>
)}
</div>
</div>
);
+5
View File
@@ -37,6 +37,11 @@ export function Settings() {
);
})}
</div>
{import.meta.env.VERSION && (
<div className="text-center text-xs text-muted-foreground/60 pt-4">
v{import.meta.env.VERSION}
</div>
)}
</div>
);
}
+14
View File
@@ -1,14 +1,28 @@
import { execSync } from "node:child_process";
import path from "node:path";
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "vitest/config";
function getVersion(): string {
try {
const gitCommit = execSync('git rev-parse --short HEAD').toString().trim();
const commitDate = execSync('git log -1 --format=%cd --date=format:%Y.%m.%d').toString().trim();
return `${commitDate}+${gitCommit}`;
} catch {
return new Date().toISOString().split('T')[0].replace(/-/g, '.');
}
}
// https://vitejs.dev/config/
export default defineConfig(() => ({
server: {
host: "::",
port: 8080,
},
define: {
'import.meta.env.VERSION': JSON.stringify(getVersion()),
},
plugins: [
react(),
],