Give the front end its version through the build environment

vite.config.js reads RUNESTONE_VERSION and falls back to package.json.
The installer build sets RUNESTONE_VERSION and writes all four version
files only after the installer exists. Before, it wrote package.json
before the build and restored it after a failure.

The installation guide and CLAUDE.md now say that setup replaces the
installed app in place. The installer no longer shows a maintenance page.
This commit is contained in:
Knotty Wyvern
2026-10-27 22:59:22 -07:00
parent 7914942698
commit 70510a114f
8 changed files with 37 additions and 24 deletions
+8
View File
@@ -1,6 +1,11 @@
import { defineConfig } from "vite";
import { sveltekit } from "@sveltejs/kit/vite";
import process from "node:process";
import { readFileSync } from "node:fs";
// The installer build sets RUNESTONE_VERSION. It writes package.json only after the build completes.
const packageVersion = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
const appVersion = process.env.RUNESTONE_VERSION || packageVersion;
const host = process.env.TAURI_DEV_HOST;
const monacoCss = `${process.cwd().replaceAll("\\", "/")}/node_modules/monaco-editor/min/vs/editor/editor.main.css`;
@@ -8,6 +13,9 @@ const monacoCss = `${process.cwd().replaceAll("\\", "/")}/node_modules/monaco-ed
// https://vite.dev/config/
export default defineConfig(() => ({
plugins: [sveltekit()],
define: {
__RUNESTONE_VERSION__: JSON.stringify(appVersion),
},
resolve: {
alias: {
"monaco-editor-css": monacoCss,