- Spec header, status pill and footer now document '<env> @ <hash>' instead of invented release numbers - Backend settings expose GIT_COMMIT_HASH / APP_ENV / APP_VERSION, mirroring the original app - Frontend bakes the short hash in at build time and shows it in the top bar
42 lines
949 B
TypeScript
42 lines
949 B
TypeScript
import { execSync } from "node:child_process";
|
|
import { fileURLToPath, URL } from "node:url";
|
|
|
|
import tailwindcss from "@tailwindcss/vite";
|
|
import react from "@vitejs/plugin-react";
|
|
import { defineConfig } from "vite";
|
|
|
|
function gitCommitHash(): string {
|
|
try {
|
|
return execSync("git rev-parse --short HEAD", {
|
|
cwd: fileURLToPath(new URL(".", import.meta.url)),
|
|
stdio: ["ignore", "pipe", "ignore"],
|
|
})
|
|
.toString()
|
|
.trim();
|
|
} catch {
|
|
return "unknown";
|
|
}
|
|
}
|
|
|
|
const backend = process.env.VITE_BACKEND ?? "http://127.0.0.1:8000";
|
|
|
|
// https://vite.dev/config/
|
|
export default defineConfig({
|
|
define: {
|
|
__GIT_COMMIT_HASH__: JSON.stringify(gitCommitHash()),
|
|
},
|
|
plugins: [react(), tailwindcss()],
|
|
resolve: {
|
|
alias: {
|
|
"@": fileURLToPath(new URL("./src", import.meta.url)),
|
|
},
|
|
},
|
|
server: {
|
|
proxy: {
|
|
"/api": backend,
|
|
"/media": backend,
|
|
"/admin": backend,
|
|
},
|
|
},
|
|
});
|