Ship Windows as a per-user NSIS installer

Replaces the Inno Setup script, which could not be built off Windows, with an
NSIS installer that cross-compiles on Linux, installs under LOCALAPPDATA with
no UAC prompt, and keeps the catalog on uninstall. build.mjs gains --installer
and --no-installer, and --publish now ships the setup exe beside the portable
zip.
This commit is contained in:
2026-11-29 01:15:52 +00:00
parent 7ecc4474c5
commit 335cb3c757
8 changed files with 442 additions and 128 deletions
+54 -17
View File
@@ -41,7 +41,8 @@ not assumed:
| Develop module | a current browser with WebGL2 (Edge, Chrome, Firefox) |
So: a clean Windows 10/11 x64 machine, a browser, and ~250 MB where the data
folder lives. No VC++ redist, no .NET, no admin prompt, no installer.
folder lives. No VC++ redist, no .NET, no admin prompt. The setup exe installs
for the current user only; the portable zip needs no installer at all.
What the launcher checks on every start (and `-Status` prints):
@@ -67,8 +68,10 @@ Official links, shown in the dialogs when relevant:
| Network | `node.exe` from nodejs.org (SHA-256 checked) and the npm registry |
| Optional: Go 1.21+ | builds `Luminary.exe`; without it the PowerShell launcher ships |
| Optional: Docker + BuildKit | the reproducible path, and the only way to get the Go exe on Linux |
| Optional: NSIS 3 | builds the setup exe; `--installer` unpacks a private copy on Linux when `makensis` is absent |
No Windows machine is required for the portable zip.
No Windows machine is required for either the portable zip or the setup exe:
NSIS cross-compiles the installer on Linux and macOS.
## Build
@@ -77,21 +80,25 @@ node windows/build.mjs # npm run build, then the bundle
node windows/build.mjs --skip-build # reuse the existing dist/
node windows/build.mjs --out /srv/builds/luminary-win
node windows/build.mjs --launcher go # fail unless Go is installed
node windows/build.mjs --skip-build --publish # also copy the zip to windows/releases
node windows/build.mjs --installer # also build the setup exe (NSIS)
node windows/build.mjs --skip-build --publish # copy the zip and setup to windows/releases
```
Output:
```
<out>/
Luminary-0.5.1-win-x64.zip the deliverable
Luminary-0.5.1-win-x64.zip the portable deliverable
installer/Luminary-0.5.1-win-x64-setup.exe the per-user installer
stage/Luminary/ the unpacked bundle (kept for inspection)
cache/node-v24.22.2-win-x64.exe pinned runtime, reused next time
cache/SHASUMS256-v24.22.2.txt
```
The build prints the zip size, its SHA-256, the Node version, the launcher kind
and the staged folder.
The build prints each artifact's size and SHA-256, the Node version, the
launcher kind and the staged folder. The setup exe is built whenever `makensis`
is found (or with `--installer`, which fetches NSIS on Linux); otherwise the zip
is built alone with a warning.
### Transferring it to Windows
@@ -120,18 +127,44 @@ is `scratch`, so `--output` exports only the zip, checksum and staged bundle.
`windows/Dockerfile.dockerignore` keeps `.git`, `node_modules` and `dist` out of
the context; the app's own `Dockerfile` is unaffected.
### Installer (optional)
### Installer
Inno Setup 6 on any Windows machine (or a Windows CI runner):
`windows/installer.nsi` wraps the same staged bundle in an NSIS setup exe. NSIS
is a cross-compiler, so this builds on the Linux host as well as on Windows:
```bat
iscc /DAppVersion=0.5.1 /DLauncher=Luminary.cmd ^
/DSourceDir="C:\builds\luminary\stage\Luminary" windows\installer.iss
```bash
node windows/build.mjs --installer # or --skip-build --installer
```
Per-user install under `%LOCALAPPDATA%\Programs\Luminary`, Start-menu and
optional desktop shortcuts, optional "start at login" (`HKCU\…\Run`), and an
uninstaller that **keeps** `%LOCALAPPDATA%\Luminary\data`.
`--installer` uses `makensis` from `PATH` or `$MAKENSIS`; if neither exists on
Linux it downloads the two Ubuntu `nsis` packages into `<out>/tools/nsis` and
runs them from there, so no root install is needed. Install it yourself with
`sudo apt install nsis`, `brew install makensis`, or the Windows installer from
<https://nsis.sourceforge.io>. Compile by hand with:
```bash
makensis -DAPP_VERSION=0.5.1 -DAPP_VERSION4=0.5.1.0 \
-DSOURCE_DIR="$PWD/stage/Luminary" windows/installer.nsi
```
The setup is per-user: **no UAC prompt**, nothing in Program Files. It installs
to `%LOCALAPPDATA%\Programs\Luminary`, creates Start-menu shortcuts (Luminary,
Stop Luminary, the data folder), an optional desktop shortcut and an optional
"start at login" (`HKCU\…\Run`), registers an uninstaller in Apps & features,
and **keeps** `%LOCALAPPDATA%\Luminary\data` when uninstalled. Before replacing
files it runs the bundle's own `Luminary.ps1 -Stop`, so an upgrade over a
running copy works without killing every `node.exe` on the machine.
Silent install and uninstall, for a script or a school lab image:
```bat
Luminary-0.5.1-win-x64-setup.exe /S
"%LOCALAPPDATA%\Programs\Luminary\Uninstall.exe" /S
```
`/D=C:\path` overrides the install folder (last argument, unquoted, as NSIS
requires). The installer refuses 32-bit Windows and anything before Windows 10,
the same limits as the launcher, but says so before copying 250 MB.
## What is in the bundle
@@ -312,8 +345,10 @@ then replaces `node.exe`. It refuses while Luminary is running. Set
- Loopback only by default; set `HOST=0.0.0.0` for LAN proofing galleries.
- The PowerShell launcher cannot clean up after a server crash; a stale
`runtime.json` is simply ignored on the next start.
- `windows/installer.iss` needs Inno Setup and is not exercised by the Linux
build.
- The setup exe cannot be executed on the Linux build host. It is verified by
unpacking it and comparing the SHA-256 of every payload file with the staged
bundle, plus `SMOKE-WINDOWS.ps1` for the installed tree; a real install and
uninstall still needs one pass on Windows.
## Troubleshooting
@@ -332,4 +367,6 @@ then replaces `node.exe`. It refuses while Luminary is running. Set
| A sign-in screen appears | the server was started without `LUMINARY_LOCAL=1`, or it is the normal server, not the bundle |
| Opens as a normal tab | Edge/Chrome not found, or `-Browser` / `LUMINARY_WINDOW=browser` was used |
| Build refuses `--out` | the path is inside the repo; choose one outside |
| SmartScreen on first run | unsigned bundle: "More info" → "Run anyway" |
| SmartScreen on first run | unsigned build: "More info" → "Run anyway" (same for the setup exe) |
| The setup exe closes immediately on 32-bit Windows | it needs a 64-bit Windows 10/11 install; use the 64-bit build |
| Installed, but no catalog after uninstall | that is intentional: `%LOCALAPPDATA%\Luminary\data` is kept |