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
This commit is contained in:
@@ -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) => (
|
||||
</div>
|
||||
|
||||
<div className="settings-foot">
|
||||
<div className="settings-build-nr">Build-Nr: {buildNr}</div>
|
||||
<button type="button" className="settings-done" onClick={onClose}>Done</button>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1 +1,5 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_LANSPREAD_BUILD_NR: string;
|
||||
}
|
||||
|
||||
@@ -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`
|
||||
//
|
||||
|
||||
Reference in New Issue
Block a user