feat(frontend): remove 'v' prefix from footer and add dev mode versioning
This commit is contained in:
@@ -4,7 +4,7 @@ const Footer: React.FC = () => {
|
|||||||
return (
|
return (
|
||||||
<footer className="py-4 text-center">
|
<footer className="py-4 text-center">
|
||||||
<p className="text-xs text-slate-500">
|
<p className="text-xs text-slate-500">
|
||||||
v{__APP_VERSION__} ({__APP_GITSHA__})
|
{__APP_VERSION__} ({__APP_GITSHA__})
|
||||||
</p>
|
</p>
|
||||||
</footer>
|
</footer>
|
||||||
);
|
);
|
||||||
|
|||||||
+14
-2
@@ -2,9 +2,21 @@ import { defineConfig } from 'vite'
|
|||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import { execSync } from 'child_process';
|
||||||
|
|
||||||
const APP_VERSION = process.env.VITE_APP_VERSION || 'unknown';
|
const isDev = process.env.NODE_ENV === 'development' || process.env.vite === 'true';
|
||||||
const APP_GITSHA = process.env.VITE_APP_GITSHA || 'unknown';
|
|
||||||
|
let APP_VERSION = process.env.VITE_APP_VERSION || 'unknown';
|
||||||
|
let APP_GITSHA = process.env.VITE_APP_GITSHA || 'unknown';
|
||||||
|
|
||||||
|
if (isDev) {
|
||||||
|
APP_VERSION = 'DEV';
|
||||||
|
try {
|
||||||
|
APP_GITSHA = execSync('git rev-parse --short HEAD').toString().trim();
|
||||||
|
} catch (e) {
|
||||||
|
APP_GITSHA = 'unknown';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
base: './',
|
base: './',
|
||||||
|
|||||||
Reference in New Issue
Block a user