From a20d298be2e22cfb9dd17bcd6350b9e99654e7b3 Mon Sep 17 00:00:00 2001 From: Andraxion Date: Sat, 27 Jun 2026 03:01:49 -0400 Subject: [PATCH] Expose launcher build stamp --- src/WorldshaperLauncher.tsx | 3 +++ src/index.css | 7 +++++++ vite.config.ts | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/WorldshaperLauncher.tsx b/src/WorldshaperLauncher.tsx index 668fb38..f2a2c02 100644 --- a/src/WorldshaperLauncher.tsx +++ b/src/WorldshaperLauncher.tsx @@ -11,6 +11,8 @@ import { import type { ChangelogItem } from "./worldshaperStudio/changelogData"; import launcherBackground from "../background.png"; +declare const __APP_BUILD__: string; + type WorldDefaultPayload = { worldId?: string; world?: { @@ -2257,6 +2259,7 @@ function WorldshaperLauncher() { +
Build {__APP_BUILD__}
{adminPanelOpen && logsModalOpen ? (
setLogsModalOpen(false)}> diff --git a/src/index.css b/src/index.css index b9e7f10..c7b58a6 100644 --- a/src/index.css +++ b/src/index.css @@ -77,6 +77,13 @@ body { width: min(1440px, 100%); } +.launcher-build-stamp { + color: #7f90ab; + font-size: 11px; + line-height: 1.4; + text-align: center; +} + .launcher-hero-window, .launcher-changelog-window { border: 1px solid #4f79af; diff --git a/vite.config.ts b/vite.config.ts index a1d7a18..bbfed1e 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -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: {