From a913e4c7768e3e1a4e62fd1386269094cdfa0882 Mon Sep 17 00:00:00 2001 From: ddidderr Date: Thu, 21 May 2026 17:27:23 +0200 Subject: [PATCH] feat(settings): show automatic build number The launcher settings dialog now shows a Build-Nr value in its footer so users can identify the exact application build without manually updating a number before release. The value is generated by Vite when the frontend bundle is built and injected as an import.meta.env constant. Using the current millisecond timestamp keeps the number numeric and monotonic for normal builds without a checked-in counter file or any extra build-state mutation. The tradeoff is that the value follows the build machine clock rather than a central sequence service. The footer layout now keeps the build number on the lower left and the Done button on the lower right. Test Plan: - just frontend-test - just build - git diff --cached --check Refs: local user request --- .../src/components/modals/SettingsDialog.tsx | 3 +++ crates/lanspread-tauri-deno-ts/src/styles/launcher.css | 9 ++++++++- crates/lanspread-tauri-deno-ts/src/vite-env.d.ts | 4 ++++ crates/lanspread-tauri-deno-ts/vite.config.ts | 6 ++++++ 4 files changed, 21 insertions(+), 1 deletion(-) diff --git a/crates/lanspread-tauri-deno-ts/src/components/modals/SettingsDialog.tsx b/crates/lanspread-tauri-deno-ts/src/components/modals/SettingsDialog.tsx index 58492bd..49e7083 100644 --- a/crates/lanspread-tauri-deno-ts/src/components/modals/SettingsDialog.tsx +++ b/crates/lanspread-tauri-deno-ts/src/components/modals/SettingsDialog.tsx @@ -18,6 +18,8 @@ interface Props { onClose: () => void; } +const buildNr = import.meta.env.VITE_LANSPREAD_BUILD_NR; + interface RowProps { label: string; hint: string; @@ -126,6 +128,7 @@ export const SettingsDialog = ({ settings, onChange, onClose }: Props) => (
+
Build-Nr: {buildNr}
diff --git a/crates/lanspread-tauri-deno-ts/src/styles/launcher.css b/crates/lanspread-tauri-deno-ts/src/styles/launcher.css index fa1667b..1059279 100644 --- a/crates/lanspread-tauri-deno-ts/src/styles/launcher.css +++ b/crates/lanspread-tauri-deno-ts/src/styles/launcher.css @@ -1468,11 +1468,18 @@ } .settings-foot { display: flex; - justify-content: flex-end; + align-items: center; + justify-content: space-between; padding: 14px 22px 18px; border-top: 1px solid var(--bd-1); gap: 10px; } +.settings-build-nr { + min-width: 0; + color: var(--t-3); + font-size: 12px; + font-variant-numeric: tabular-nums; +} .settings-done { height: 36px; padding: 0 22px; diff --git a/crates/lanspread-tauri-deno-ts/src/vite-env.d.ts b/crates/lanspread-tauri-deno-ts/src/vite-env.d.ts index 11f02fe..be02c2d 100644 --- a/crates/lanspread-tauri-deno-ts/src/vite-env.d.ts +++ b/crates/lanspread-tauri-deno-ts/src/vite-env.d.ts @@ -1 +1,5 @@ /// + +interface ImportMetaEnv { + readonly VITE_LANSPREAD_BUILD_NR: string; +} diff --git a/crates/lanspread-tauri-deno-ts/vite.config.ts b/crates/lanspread-tauri-deno-ts/vite.config.ts index f74d1b2..ce60391 100644 --- a/crates/lanspread-tauri-deno-ts/vite.config.ts +++ b/crates/lanspread-tauri-deno-ts/vite.config.ts @@ -1,12 +1,18 @@ import { defineConfig } from "vite"; import react from "@vitejs/plugin-react"; +// A timestamp keeps build numbers monotonic without a checked-in counter file. +const buildNr = Date.now().toString(); + // @ts-expect-error process is a nodejs global const host = process.env.TAURI_DEV_HOST; // https://vitejs.dev/config/ export default defineConfig(async () => ({ plugins: [react()], + define: { + "import.meta.env.VITE_LANSPREAD_BUILD_NR": JSON.stringify(buildNr), + }, // Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build` //