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:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user