From 7914942698c0c3754bf92a6d2f0333ce115aa069 Mon Sep 17 00:00:00 2001 From: Knotty Wyvern Date: Tue, 27 Oct 2026 22:53:14 -0700 Subject: [PATCH] Use the stock Tauri NSIS template with RuneStone installer hooks Remove the 996-line fork of the Tauri 2.11.4 template and the custom comparator. src-tauri/windows/hooks.nsh now adds the RuneStone behavior through bundle.windows.nsis.installerHooks: - RuneStoneGuiInit (MUI_CUSTOMFUNCTION_GUIINIT) runs before the first page in interactive and passive setup. It stops a downgrade with exit code 2. It makes the stock maintenance page skip itself, so that setup never starts the uninstaller for an upgrade or a reinstall. - The hidden section RuneStoneVersionCheck runs before the Tauri sections in all modes. Silent setup shows no pages, so it needs this check. - NSIS_HOOK_POSTINSTALL writes the release version to DisplayVersion and RuneStoneReleaseVersion, and the Windows version to RuneStoneWindowsVersion. Installed apps now show 0.1.23a, not 0.1.23+1. Setup compares the four-number Windows encoding with ${VersionCompare}. An unknown installed version stops setup. buildInstaller.mjs gives the toolchain version to Tauri through a --config override. It writes tauri.conf.json, Cargo.toml, and Cargo.lock only after the installer is complete. package.json changes during the build because the Settings dialog imports its version. A failed build restores it. Add --dry-run, which prints the plan and changes no file. The tests compile NSIS programs with the real makensis. They simulate the installed version in a test-only HKCU key and check /S, /P, /UPDATE, and interactive setup. A drift check reads the template from the installed Tauri CLI. The first real installer needs the installer checks in docs/builds.md. --- docs/builds.md | 94 +- docs/releases.md | 2 +- scripts/buildInstaller.mjs | 231 +++-- src-tauri/tauri.windows.conf.json | 3 +- src-tauri/windows/LICENSE-MIT.tauri | 21 - src-tauri/windows/hooks.nsh | 231 +++++ src-tauri/windows/installer.nsi | 996 -------------------- src-tauri/windows/versionCompare.nsh | 124 --- tests/unit/release/buildInstaller.spec.ts | 121 +++ tests/unit/release/installerVersion.spec.ts | 261 ++++- 10 files changed, 784 insertions(+), 1300 deletions(-) delete mode 100644 src-tauri/windows/LICENSE-MIT.tauri create mode 100644 src-tauri/windows/hooks.nsh delete mode 100644 src-tauri/windows/installer.nsi delete mode 100644 src-tauri/windows/versionCompare.nsh create mode 100644 tests/unit/release/buildInstaller.spec.ts diff --git a/docs/builds.md b/docs/builds.md index 78776a2..0c1ede7 100644 --- a/docs/builds.md +++ b/docs/builds.md @@ -22,7 +22,8 @@ Procedure, in the RuneStone repository root: 2. Run `pnpm check`. 3. Run `pnpm test`. 4. Select the version with the [version policy](releases.md#versions). -5. Run `pnpm build:installer --version `. +5. Run `pnpm build:installer --version --dry-run`. Make sure that the plan shows the correct versions. A dry run changes no file. +6. Run `pnpm build:installer --version `. Without `--version`, the script uses the version in `package.json`. @@ -43,32 +44,37 @@ Example, from the 0.1.44 download link in the README: version `0.1.44` gives `re Source: `scripts/buildInstaller.mjs`. 1. Reads the version and makes sure that all version fields match the current version. -2. Makes sure that downgrade protection stays on in `tauri.conf.json` and `tauri.windows.conf.json`, and that the browser runtime is staged. +2. Makes sure that downgrade protection stays on in `tauri.conf.json` and `tauri.windows.conf.json`. + Makes sure that `tauri.windows.conf.json` names the installer hooks and that the browser runtime is staged. 3. Stops if the setup file or `host.json` exists in the bundle folder or in `releases//`. + A dry run prints the plan and stops here. 4. Saves copies of the four version files as `*.before` in `output/installer-build//