Files
TRIMSP/packaging/wsl2/require-rootfs.js
salman 5110ea4827 Build the Windows installer with electron-builder (NSIS)
The Squirrel path (electron-forge maker-squirrel -> electron-winstaller)
required Wine and Mono, plus a 64-bit Wine prefix, to cross-build on Linux.
electron-builder's NSIS target uses its own native tooling, so the same
cross-build now needs no Wine and no Mono, matching how muSRFlow is packaged.

- package.json: add an electron-builder 'build' block (win/nsis, extraResources
  for the engine and the flat rootfs, files allow-list, nsis options) and point
  package:win/make:win at 'electron-builder --win nsis'; drop maker-squirrel.
- packaging/wsl2/require-rootfs.js: fail the Windows build when the rootfs is
  missing (electron-builder has no config-time abort hook).
- forge.config.js: drop the Squirrel maker and the Windows rootfs guard; forge
  now builds Linux/macOS only.
- README/CHANGELOG: document the NSIS build and that no Wine/Mono is needed.

Verified locally: TRIMSP-NL-Workbench-Setup.exe (NSIS, 186 MB) builds with no
Wine/Mono; resources/bin/trimspNL and resources/trimspNL-runtime-rootfs.tar.gz
land where wsl-runtime.js looks; guard fails on a missing rootfs.
2026-10-20 13:35:17 +02:00

26 lines
952 B
JavaScript

#!/usr/bin/env node
// Refuse to build the Windows installer without the WSL2 engine runtime.
//
// Windows cannot run the bundled Linux engine natively, so the installer must
// ship the rootfs archive (packaging/wsl2/out/trimspNL-runtime-rootfs.tar.gz)
// that the app imports as a private WSL2 distribution on first run. Building
// without it would silently produce an installer whose engine cannot start.
//
// electron-builder has no config-time hook that can abort the build, so the
// `dist:win` script runs this first.
const fs = require('fs');
const path = require('path');
const rootfs = path.resolve(
__dirname, 'out', 'trimspNL-runtime-rootfs.tar.gz');
if (!fs.existsSync(rootfs)) {
console.error(
'Windows build requires the WSL2 engine runtime, but\n ' + rootfs
+ '\nis missing. Build it first from Linux/WSL with:\n npm run build:wsl2');
process.exit(1);
}
console.log('WSL2 rootfs found: ' + rootfs);