mirror of
https://gitlab.com/soapbox-pub/shakespeare.git
synced 2026-12-03 07:57:22 +00:00
Add CalVer to Settings
This commit is contained in:
3 files changed
+25
No files matched your search
@@ -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>
|
||||
);
|
||||
|
||||
@@ -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>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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(),
|
||||
],
|
||||
|
||||
Reference in new issue
Block a user