Expose launcher build stamp

This commit is contained in:
Andraxion 2026-06-27 03:01:49 -04:00
parent e40a596258
commit a20d298be2
3 changed files with 29 additions and 0 deletions

View file

@ -1,10 +1,29 @@
import { execSync } from "node:child_process";
import { readFileSync } from "node:fs";
import { resolve } from "node:path";
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";
const packageJson = JSON.parse(readFileSync(resolve(__dirname, "package.json"), "utf8")) as { version?: string };
function readGitCommit(): string {
try {
return execSync("git rev-parse --short HEAD", { cwd: __dirname, stdio: ["ignore", "pipe", "ignore"] })
.toString()
.trim();
} catch {
return "dev";
}
}
const appBuildLabel = `v${packageJson.version || "0.0.0"}-${readGitCommit()}`;
// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
define: {
__APP_BUILD__: JSON.stringify(appBuildLabel),
},
build: {
rollupOptions: {
input: {