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:
@@ -38,9 +38,8 @@ export async function planInstallerBuild(root, requestedVersion) {
|
||||
if (windowsConfig?.allowDowngrades !== false) throw Error('Downgrade protection must remain enabled.');
|
||||
const hooks = windowsConfig?.nsis?.installerHooks;
|
||||
if (!hooks || !(await exists(path.join(root, 'src-tauri', hooks)))) throw Error('The installer hooks file is not configured. See src-tauri/tauri.windows.conf.json.');
|
||||
if (!(await exists(path.join(root, 'src-tauri/browser-engine/RuneStone-Browser.exe')))) {
|
||||
throw Error('The browser runtime is not staged. Run pnpm browser:stage first. See docs/development.md#built-in-browser-runtime.');
|
||||
}
|
||||
// The browser engine is a separate download. See docs/builds.md#build-the-browser-engine.
|
||||
if (JSON.stringify(config.bundle?.resources ?? {}).includes('browser-engine')) throw Error('The installer must not bundle the browser engine.');
|
||||
const bundleDir = path.join(root, 'src-tauri/target/release/bundle/nsis');
|
||||
const releaseDir = path.join(root, 'releases', next.version);
|
||||
const artifacts = {
|
||||
@@ -63,7 +62,9 @@ export async function planInstallerBuild(root, requestedVersion) {
|
||||
const override = { version: next.toolchain };
|
||||
// vite.config.js gives this version to the front end, so package.json can wait until the build completes.
|
||||
const env = { RUNESTONE_VERSION: next.version };
|
||||
return { root, files, before, updated, current, next, override, env, releaseDir, artifacts };
|
||||
// The core installer is about 10 MB. A larger file means that something such as the engine got into the bundle.
|
||||
const maxSetupBytes = 30 * 1024 * 1024;
|
||||
return { root, files, before, updated, current, next, override, env, releaseDir, artifacts, maxSetupBytes };
|
||||
}
|
||||
|
||||
// The commands of a build, in order. overridePath is the file with plan.override.
|
||||
@@ -102,7 +103,8 @@ export async function runInstallerBuild(plan, run, staging) {
|
||||
let complete = false;
|
||||
try {
|
||||
for (const { command, args } of buildCommands(plan, overridePath)) await run(command, args);
|
||||
await fs.access(artifacts.bundled);
|
||||
const size = (await fs.stat(artifacts.bundled)).size;
|
||||
if (size > plan.maxSetupBytes) throw Error(`The setup file has ${size} bytes, more than the limit of ${plan.maxSetupBytes}. Make sure that the bundle does not include the browser engine.`);
|
||||
if (artifacts.bundled !== artifacts.renamed) await fs.rename(artifacts.bundled, artifacts.renamed);
|
||||
await fs.mkdir(plan.releaseDir, { recursive: true });
|
||||
await fs.copyFile(artifacts.renamed, artifacts.release, fs.constants.COPYFILE_EXCL);
|
||||
|
||||
Reference in New Issue
Block a user