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;
|
onClose: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const buildNr = import.meta.env.VITE_LANSPREAD_BUILD_NR;
|
||||||
|
|
||||||
interface RowProps {
|
interface RowProps {
|
||||||
label: string;
|
label: string;
|
||||||
hint: string;
|
hint: string;
|
||||||
@@ -126,6 +128,7 @@ export const SettingsDialog = ({ settings, onChange, onClose }: Props) => (
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="settings-foot">
|
<div className="settings-foot">
|
||||||
|
<div className="settings-build-nr">Build-Nr: {buildNr}</div>
|
||||||
<button type="button" className="settings-done" onClick={onClose}>Done</button>
|
<button type="button" className="settings-done" onClick={onClose}>Done</button>
|
||||||
</div>
|
</div>
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|||||||
@@ -1468,11 +1468,18 @@
|
|||||||
}
|
}
|
||||||
.settings-foot {
|
.settings-foot {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: flex-end;
|
align-items: center;
|
||||||
|
justify-content: space-between;
|
||||||
padding: 14px 22px 18px;
|
padding: 14px 22px 18px;
|
||||||
border-top: 1px solid var(--bd-1);
|
border-top: 1px solid var(--bd-1);
|
||||||
gap: 10px;
|
gap: 10px;
|
||||||
}
|
}
|
||||||
|
.settings-build-nr {
|
||||||
|
min-width: 0;
|
||||||
|
color: var(--t-3);
|
||||||
|
font-size: 12px;
|
||||||
|
font-variant-numeric: tabular-nums;
|
||||||
|
}
|
||||||
.settings-done {
|
.settings-done {
|
||||||
height: 36px;
|
height: 36px;
|
||||||
padding: 0 22px;
|
padding: 0 22px;
|
||||||
|
|||||||
@@ -1 +1,5 @@
|
|||||||
/// <reference types="vite/client" />
|
/// <reference types="vite/client" />
|
||||||
|
|
||||||
|
interface ImportMetaEnv {
|
||||||
|
readonly VITE_LANSPREAD_BUILD_NR: string;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,12 +1,18 @@
|
|||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
import react from "@vitejs/plugin-react";
|
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
|
// @ts-expect-error process is a nodejs global
|
||||||
const host = process.env.TAURI_DEV_HOST;
|
const host = process.env.TAURI_DEV_HOST;
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig(async () => ({
|
export default defineConfig(async () => ({
|
||||||
plugins: [react()],
|
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`
|
// Vite options tailored for Tauri development and only applied in `tauri dev` or `tauri build`
|
||||||
//
|
//
|
||||||
|
|||||||
Reference in New Issue
Block a user