add version card to settings, branch push protection

This commit is contained in:
Zimeng Xiong
2025-11-23 08:35:36 -08:00
parent 8f9ac1f9c0
commit c502f1c0bd
7 changed files with 107 additions and 22 deletions
+24
View File
@@ -1,5 +1,29 @@
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
import fs from "fs";
import path from "path";
const versionFilePath = path.resolve(__dirname, "../VERSION");
let versionFromFile = "0.0.0";
try {
const raw = fs.readFileSync(versionFilePath, "utf8").trim();
if (raw) {
versionFromFile = raw;
}
} catch (error) {
console.warn("Unable to read VERSION file:", error);
}
if (
!process.env.VITE_APP_VERSION ||
process.env.VITE_APP_VERSION.trim().length === 0
) {
process.env.VITE_APP_VERSION = versionFromFile;
if (!process.env.VITE_APP_BUILD_LABEL) {
process.env.VITE_APP_BUILD_LABEL = "local development build";
}
}
// https://vite.dev/config/
export default defineConfig({