Ship the browser engine as its own release file

The installer no longer bundles the engine, and the installer script
stops when the bundle names it or when the setup file is over 30 MB.
pnpm build:browser-engine packages the engine, writes a deterministic
ZIP and its record to releases/browser-engine/<version>/, and pins the
ZIP in the host. The installer hooks remove the engine folder that 0.1.48
leaves behind, and uninstall removes the downloaded engine.
This commit is contained in:
Knotty Wyvern
2026-10-29 01:25:53 -07:00
parent c06d48f250
commit aebe700366
18 changed files with 511 additions and 52 deletions
+48 -10
View File
@@ -13,7 +13,7 @@ Use the [release policy](releases.md) to select the version, store the files, an
Prerequisites:
- The source setup in [Run from source](development.md#run-from-source).
- A Windows Browser runtime staged in `src-tauri/browser-engine`. See [Built-in browser runtime](development.md#built-in-browser-runtime). The installer bundles that folder.
- The pin of the browser engine in `src-tauri/browser-engine.json`. To build a new engine first, see [Build the browser engine](#build-the-browser-engine). The installer does not include the engine.
- Internet access for the first build. Tauri downloads NSIS and the WebView2 bootstrapper.
Procedure, in the RuneStone repository root:
@@ -45,7 +45,7 @@ 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`.
Makes sure that `tauri.windows.conf.json` names the installer hooks and that the browser runtime is staged.
Makes sure that `tauri.windows.conf.json` names the installer hooks and that `tauri.conf.json` does not bundle the browser engine.
3. Stops if the setup file or `host.json` exists in the bundle folder or in `releases/<version>/`.
A dry run prints the plan and stops here.
4. Saves copies of the four version files as `*.before` in `output/installer-build/<version>/<time>/`, a new folder for each attempt.
@@ -55,7 +55,8 @@ Source: `scripts/buildInstaller.mjs`.
Tauri gives the override to the Rust build script and to the app. Cargo keeps the previous package version, so the app must not use `CARGO_PKG_VERSION`.
6. Runs `scripts/setWindowsVersion.ps1`. It writes the release version to the `FileVersion` and `ProductVersion` strings of `runestone.exe`. Tauri can write only a SemVer version to these strings.
7. Runs `tauri bundle --bundles nsis --config <override>`. Tauri uses its stock NSIS template with the [installer hooks](#installer-hooks).
8. Moves the setup file into `releases/<version>/`, writes `host.json`, and removes the bundle-folder copy.
8. Stops if the setup file is larger than 30 MB. The core installer is about 10 MB.
Moves the setup file into `releases/<version>/`, writes `host.json`, and removes the bundle-folder copy.
9. Writes the new version to `package.json`, `tauri.conf.json`, `Cargo.toml`, and `Cargo.lock`.
### Failure and rollback
@@ -77,6 +78,8 @@ Keep these properties when you change the installer configuration or hooks:
| Windows shows the release version in installed apps. | The hooks write the release version, such as `0.1.23a`, to `DisplayVersion`. |
| The app identity stays the same across upgrades. | The identifier stays `com.runestone.app`. |
| WebView2 is available. | The installer embeds the WebView2 bootstrapper. If the runtime is missing, setup downloads it. |
| An update removes the engine folder of releases up to 0.1.48. | `NSIS_HOOK_POSTINSTALL` removes `$INSTDIR\browser-engine`. The uninstaller of the old version does not run, so nothing else removes it. |
| Uninstall removes the downloaded browser engine. The browser profiles stay unless the user deletes the app data. | `NSIS_HOOK_POSTUNINSTALL` removes `browser-engine` in the local app data folder, except during an update. |
The installer uses the RuneStone icon, installs for the current Windows account, and adds a Start menu shortcut and an uninstaller.
It does not register document types or start RuneStone when Windows starts.
@@ -93,7 +96,8 @@ RuneStone uses the stock NSIS template of the Tauri CLI.
| --- | --- | --- |
| `RuneStoneGuiInit`, set as `MUI_CUSTOMFUNCTION_GUIINIT` | Interactive and passive (`/P`) setup, before the first page | Stops a downgrade. Makes the maintenance page skip itself. |
| Section `-RuneStoneVersionCheck` | All modes, before the Tauri sections | Restores the current-user context. Stops a downgrade. Silent setup shows no pages, so it needs this check. |
| `NSIS_HOOK_POSTINSTALL` | At the end of the Tauri `Install` section | Writes `DisplayVersion`, `RuneStoneReleaseVersion`, and `RuneStoneWindowsVersion`. |
| `NSIS_HOOK_POSTINSTALL` | At the end of the Tauri `Install` section | Writes `DisplayVersion`, `RuneStoneReleaseVersion`, and `RuneStoneWindowsVersion`. Removes `$INSTDIR\browser-engine`. |
| `NSIS_HOOK_POSTUNINSTALL` | At the end of the Tauri `Uninstall` section | Removes `$LOCALAPPDATA\com.runestone.app\browser-engine`, except in update mode. |
Tauri includes the hooks file before the template variables, pages, and sections.
Thus only the `NSIS_HOOK_*` macros can use template symbols such as `${VERSION}`.
@@ -147,12 +151,15 @@ Do all checks in this table for the first installer that uses the stock template
| Open RuneStone from the Start menu | The app opens without a terminal or a development server. |
| Create a workspace outside the installation folder | Notes save and open again. |
| Install the new version over 0.1.44 | Setup shows no maintenance page and does not start the uninstaller. It updates the app and keeps workspace files and settings. |
| Install the new version over 0.1.48 | The `browser-engine` folder in the installation folder is gone. At the first browser start, the browser profiles move from `%APPDATA%` to `%LOCALAPPDATA%`. |
| Open a browser tab, then select **Download the engine** | The download shows its progress. Then the tab opens its page. |
| Open a browser tab without internet access | The tab shows the cause, **Retry**, and **Install from file…**. Web links in documents open in the system browser. |
| Install the same version again | Setup shows no maintenance page and does not start the uninstaller. It keeps workspace files and settings. |
| Install an older version, for example 0.1.44 | Setup blocks the downgrade. |
| Silent downgrade attempt | See the procedure below this table. Setup stops with exit code 2 and changes nothing. |
| Open **Settings → Apps → Installed apps** in Windows | The RuneStone entry shows the release version, such as `0.1.45` or `0.1.45a`. |
| Install a hotfix over its base version | Setup updates the app. |
| Remove RuneStone through Windows Settings | The app and shortcuts are removed. The separate workspace stays. |
| Remove RuneStone through Windows Settings | The app, the shortcuts, and the downloaded browser engine are removed. The separate workspace stays. |
Silent downgrade attempt, in PowerShell on the test account:
@@ -165,12 +172,43 @@ Silent downgrade attempt, in PowerShell on the test account:
5. Run the same command with `-ArgumentList '/P'`. Setup shows a message, then stops with exit code `2`.
6. Restore the registry value: set `RuneStoneWindowsVersion` to the `windowsVersion` value in `host.json`.
## Build the browser engine
`pnpm build:browser-engine` packages the browser engine for 64-bit Windows (x64) as a ZIP. Then it pins that ZIP in `src-tauri/browser-engine.json`. Each later host build downloads the pinned engine on first use.
Build and publish the engine before the installer that pins it. An installer needs a new engine only when the engine changes.
Prerequisites:
- Windows x64. The script stops on other systems, because no other platform has a published engine yet.
- `npm ci --prefix browser-runtime`, then `pnpm browser:check` and `pnpm browser:test`. See [Built-in browser runtime](development.md#built-in-browser-runtime).
- The public folder URL of the engine release. See [Publish a browser engine](releases.md#publish-a-browser-engine).
Procedure, in the RuneStone repository root:
1. Select the engine version with the [version policy](releases.md#versions). The engine version is in `browser-runtime/package.json`.
2. Run `pnpm build:browser-engine --release-url <folder URL> --version <version> --dry-run`. Make sure that the plan shows the correct version and URL. A dry run changes no file.
3. Run `pnpm build:browser-engine --release-url <folder URL> --version <version>`.
4. Publish the ZIP. See [Publish a browser engine](releases.md#publish-a-browser-engine).
Output:
| File | Contents |
| --- | --- |
| `releases/browser-engine/<version>/RuneStone-Browser_<version>_win32-x64.zip` | The engine files at the archive root, in name order, with a fixed time stamp |
| `releases/browser-engine/<version>/engine.json` | The version, the protocol, the platform key, the file name, the URL, the size in bytes, and the SHA-256 hash |
| `src-tauri/browser-engine.json` | The pin: the engine version, the protocol, and the URL, size, and SHA-256 for `windows-x86_64` |
The script prints `Engine available: <path>`, the size, the hash, and the upload URL when it completes.
The script writes the new version to `browser-runtime/package.json` and `package-lock.json` before it packages the engine, because the engine reports that version. If a step fails, the script restores these files and the pin. The backups are in `output/browser-engine-build/<version>/<time>/`.
The script reads `PROTOCOL` in `src-tauri/src/browser_engine.rs` and the protocol of the `ready` event in `browser-runtime/src/engine-main.mjs`. It stops if they differ.
Example, with Electron 44.5.1 from `browser-runtime/package.json`: the engine files are 377 MB, and the ZIP is about 160 MB.
## Build Linux packages
Prerequisites:
- The [Linux development prerequisites](linux.md) on the processor architecture of the package.
- A Linux Browser runtime for that architecture, staged in `src-tauri/browser-engine`.
- The new version in all RuneStone version fields. No Linux script sets or restores them. See [Versions](releases.md#versions).
Procedure, in the RuneStone repository root. The commands use the Tauri CLI from `package.json` and the bundle settings in `src-tauri/tauri.linux.conf.json`.
@@ -194,6 +232,7 @@ If the build fails, restore the previous version fields.
Example, from the 0.1.44 download link in the README: the x86_64 Debian build of version `0.1.44` is `RuneStone_0.1.44_amd64.deb`.
`pnpm build:installer` does not build Linux packages. It stops on operating systems other than Windows.
Linux packages do not include the browser engine, and no Linux engine is published yet. The browser tab says that no engine is available for the platform.
No Linux script encodes hotfix versions, and Tauri rejects a letter suffix in `tauri.conf.json`. Report this blocker before a Linux hotfix build.
The Debian package depends on `libc6 (>= 2.39)`, as set in `tauri.linux.conf.json`.
@@ -217,7 +256,7 @@ For an example record, see the [Linux 0.1.44 validation](archive/linux-validatio
macOS packages are experimental. RuneStone has no validated macOS release procedure.
Prerequisites: a Mac, the source setup, and a Browser runtime packaged and staged on that Mac.
Prerequisites: a Mac and the source setup.
In the RuneStone repository root, run:
@@ -227,9 +266,8 @@ pnpm tauri build --bundles app -- --locked
Tauri puts the application bundle in `src-tauri/target/release/bundle/macos/`. No script sets the version fields on macOS.
Example, from the [macOS 0.1.44 record](archive/macos-validation-0.1.44.md): the 0.1.44 DMG used manual steps after this build.
Those steps replaced the bundled Browser resources with a copy that keeps the Electron framework symbolic links.
Then they applied ad hoc signatures and created the DMG.
macOS packages do not include the browser engine, and no macOS engine is published yet.
The [macOS 0.1.44 record](archive/macos-validation-0.1.44.md) describes the ad hoc signatures and the DMG steps of that release.
Developer ID signing, notarization, Intel builds, and desktop acceptance tests are not done for macOS.
See [Tauri's macOS application bundle guide](https://v2.tauri.app/distribute/macos-application-bundle/).
+1 -1
View File
@@ -283,7 +283,7 @@ Before you start the app, set `WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS=--remote-de
## Built-in browser runtime
The browser interface is in `src/lib/browser/`. The browser engine, its tests, and its notices are in `browser-runtime/`.
The engine is a separate download. Users install it on first use.
The engine is a separate download. Users install it on first use. To build and publish it, see [Build the browser engine](builds.md#build-the-browser-engine).
1. Run `npm ci --prefix browser-runtime`.
2. Run `pnpm browser:check` and `pnpm browser:test`.
+3 -1
View File
@@ -45,6 +45,8 @@ Some distributions limit user namespaces, which the sandbox can need. Test the B
The native host uses WebKitGTK and the Browser uses Electron. Test both.
Linux packages do not include the engine, and no Linux engine download exists yet. A package says that no engine is available for the platform. `pnpm tauri dev` starts the staged engine.
## Checks
Run the source checks in [Checks](development.md#checks) and the tests in [Browser smoke tests](development.md#browser-smoke-tests).
@@ -64,7 +66,7 @@ Voice typing is not part of the Linux checks.
| Launch and windows | Open from the desktop. Move, resize, minimize, maximize, and close. Unsaved edits start the close guard. |
| Files and paths | Create, save, open again, rename, copy, and delete files. Check spaces, Unicode, and distinct `Note.md` and `note.md` files. |
| External edits | Edit a file in a different editor. RuneStone finds the change and does not silently replace conflicting edits. |
| Built-in Browser | Open a web page, type, scroll, open and close tabs, download a file, and restart the app. Check the packaged runtime too. |
| Built-in Browser | In `pnpm tauri dev` with the staged engine, open a web page, type, scroll, open and close tabs, download a file, and restart the app. In a package, a browser tab says that no engine is available. |
| Editors | Edit Markdown, source code, tables, images, and diagrams. Check undo, keyboard shortcuts, and both themes. |
| Clipboard and dialogs | Copy and paste text, tables, and images. Check folder selection, external links, and file reveal. |
| Plugins | Install plugin ZIPs through Settings, enable them, restart, disable them, and remove them. Check that plugin data stays. |
+24 -4
View File
@@ -6,7 +6,7 @@ This policy sets version numbers, release file storage, and publication steps fo
## Versions
RuneStone and each plugin keep separate version numbers. Each project uses the form `zz.yy.xx`.
RuneStone, the browser engine, and each plugin keep separate version numbers. Each project uses the form `zz.yy.xx`.
| Part | Increase it for | Then reset |
| --- | --- | --- |
@@ -14,7 +14,7 @@ RuneStone and each plugin keep separate version numbers. Each project uses the f
| `yy` | A deliberate release that is ready for build testing, by direction of the project owner | `xx` to zero |
| `zz` | A full release, by direction of the project owner | `yy` and `xx` to zero |
A build is a RuneStone installer or a plugin ZIP, unless the project owner asks for a different distributable.
A build is a RuneStone installer, a browser engine ZIP, or a plugin ZIP, unless the project owner asks for a different distributable.
Development servers, test runs, and intermediate compilation output are not builds.
- Keep routine implementation work in the current `zz.yy` series.
@@ -29,12 +29,16 @@ Development servers, test runs, and intermediate compilation output are not buil
| Project | Version fields |
| --- | --- |
| RuneStone | `package.json`, `src-tauri/tauri.conf.json`, the package version and `[package.metadata.runestone]` in `src-tauri/Cargo.toml`, and the `runestone` entry in `src-tauri/Cargo.lock` |
| Browser engine | `version` in `browser-runtime/package.json`, and the two `version` fields of `browser-runtime/package-lock.json` |
| Plugin | `plugin.json`, the project `package.json`, and any build metadata |
| Plugin SDK | `packages/plugin-sdk/package.json`. See [SDK releases](#sdk-releases). |
On Windows, `pnpm build:installer --version <version>` sets the RuneStone fields when the installer is complete. If the build fails, the fields keep the previous version.
See [Build the Windows installer](builds.md#build-the-windows-installer).
`pnpm build:browser-engine --release-url <folder URL> --version <version>` sets the engine fields and the pin in `src-tauri/browser-engine.json` when the ZIP is complete. If the build fails, they keep their previous contents.
See [Build the browser engine](builds.md#build-the-browser-engine).
## Hotfix versions
A hotfix fixes one item or a narrowly scoped problem in an existing release.
@@ -64,6 +68,7 @@ These rules apply to the main app, all existing plugins, and all new plugins.
| Release | Folder |
| --- | --- |
| RuneStone installer | `releases/<version>/` at the RuneStone project root |
| Browser engine ZIP | `releases/browser-engine/<version>/` at the RuneStone project root |
| Plugin ZIP | `releases/` at the root of that plugin project |
- Keep release notes, checksums, and build metadata with the release they describe, in the local release folder.
@@ -77,8 +82,8 @@ These rules apply to the main app, all existing plugins, and all new plugins.
- Report a filename conflict before you change a file name.
- After each completed build, report the full path of the build file.
`pnpm build:installer` and `pnpm package:plugin` obey these rules for their own output.
The installer script stops if the release file exists. The plugin packager reuses an identical ZIP and stops if the existing ZIP has different contents.
`pnpm build:installer`, `pnpm build:browser-engine`, and `pnpm package:plugin` obey these rules for their own output.
The installer and engine scripts stop if the release file exists. The plugin packager reuses an identical ZIP and stops if the existing ZIP has different contents.
## Publish an installer
@@ -98,6 +103,21 @@ Do not attach Markdown files, release notes, checksums, metadata, logs, or scree
Put release notes, test results, and installation instructions in the repository documentation.
Keep the other build records in the local release folder.
## Publish a browser engine
The RuneStone repository is private, so the engine ZIP needs a public download location. Each host build downloads the URL in its pin.
1. Build the engine ZIP with the URL of its public release folder. See [Build the browser engine](builds.md#build-the-browser-engine).
2. In the public download repository, create a release with the tag `browser-engine-v<version>`.
3. Attach only the engine ZIP. Leave the release description empty.
4. Upload through the LAN address of the Gitea server. Cloudflare limits a request body to 100 MB, and the ZIP is larger.
5. Make sure that the `url` in `engine.json` downloads the ZIP without a sign-in, and that its size matches.
6. Commit `src-tauri/browser-engine.json` and the engine version fields.
7. Build the installer that pins this engine.
The Gitea attachment limit (`[attachment] MAX_SIZE`) must be larger than the ZIP. The server allowed 100 MB on 2026-10-29.
Keep each published engine ZIP. Installed RuneStone versions download the engine that they pin.
## Publish a plugin release
These rules apply on all hosting services. The service stores the files. RuneStone defines the package format, the versions, and the installation checks.