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
+1
View File
@@ -21,3 +21,4 @@ windows/launcher/webview2/obj/
# Transfer-only Windows release archives # Transfer-only Windows release archives
windows/releases/*.zip windows/releases/*.zip
windows/releases/*.exe
+54 -17
View File
@@ -41,7 +41,8 @@ not assumed:
| Develop module | a current browser with WebGL2 (Edge, Chrome, Firefox) | | 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 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): 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 | | 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: 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: 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 ## 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 --skip-build # reuse the existing dist/
node windows/build.mjs --out /srv/builds/luminary-win node windows/build.mjs --out /srv/builds/luminary-win
node windows/build.mjs --launcher go # fail unless Go is installed 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: Output:
``` ```
<out>/ <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) stage/Luminary/ the unpacked bundle (kept for inspection)
cache/node-v24.22.2-win-x64.exe pinned runtime, reused next time cache/node-v24.22.2-win-x64.exe pinned runtime, reused next time
cache/SHASUMS256-v24.22.2.txt cache/SHASUMS256-v24.22.2.txt
``` ```
The build prints the zip size, its SHA-256, the Node version, the launcher kind The build prints each artifact's size and SHA-256, the Node version, the
and the staged folder. 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 ### 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 `windows/Dockerfile.dockerignore` keeps `.git`, `node_modules` and `dist` out of
the context; the app's own `Dockerfile` is unaffected. 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 ```bash
iscc /DAppVersion=0.5.1 /DLauncher=Luminary.cmd ^ node windows/build.mjs --installer # or --skip-build --installer
/DSourceDir="C:\builds\luminary\stage\Luminary" windows\installer.iss
``` ```
Per-user install under `%LOCALAPPDATA%\Programs\Luminary`, Start-menu and `--installer` uses `makensis` from `PATH` or `$MAKENSIS`; if neither exists on
optional desktop shortcuts, optional "start at login" (`HKCU\…\Run`), and an Linux it downloads the two Ubuntu `nsis` packages into `<out>/tools/nsis` and
uninstaller that **keeps** `%LOCALAPPDATA%\Luminary\data`. 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 ## 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. - 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 - The PowerShell launcher cannot clean up after a server crash; a stale
`runtime.json` is simply ignored on the next start. `runtime.json` is simply ignored on the next start.
- `windows/installer.iss` needs Inno Setup and is not exercised by the Linux - The setup exe cannot be executed on the Linux build host. It is verified by
build. 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 ## 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 | | 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 | | 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 | | 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 |
+7 -6
View File
@@ -25,7 +25,7 @@ luminary-windows/
upstream.txt # pinned tag + commit + expected package version upstream.txt # pinned tag + commit + expected package version
build.mjs # same script as windows/build.mjs, one copy build.mjs # same script as windows/build.mjs, one copy
launcher/ # Luminary.ps1, .cmd, .vbs, Stop, go/ launcher/ # Luminary.ps1, .cmd, .vbs, Stop, go/
installer.iss installer.nsi # NSIS, builds on Linux
Dockerfile # Go + Node 24 image for the exe build Dockerfile # Go + Node 24 image for the exe build
README.md README.md
CHANGELOG.md # per-release: upstream tag, node version, hashes CHANGELOG.md # per-release: upstream tag, node version, hashes
@@ -99,14 +99,15 @@ jobs:
path: ${{ runner.temp }}/out/* path: ${{ runner.temp }}/out/*
``` ```
Optional later steps: `softprops/action-gh-release` to attach the zip to a Optional later steps: `softprops/action-gh-release` to attach the zip and setup
Gitea release, and a Windows runner that also builds `installer.iss` (Inno Setup exe to a Gitea release. NSIS runs on the Linux runner too (`--installer`), so a
is not available on Linux without Wine). Windows runner is not needed for the installer.
## Release and version policy ## Release and version policy
- One packaging release per upstream tag that should be installable on Windows; - One packaging release per upstream tag that should be installable on Windows;
the artifact is `Luminary-<version>-win-x64.zip`. the artifacts are `Luminary-<version>-win-x64-setup.exe` and the portable
`Luminary-<version>-win-x64.zip`.
- `CHANGELOG.md` records upstream tag/commit, bundled Node version, artifact - `CHANGELOG.md` records upstream tag/commit, bundled Node version, artifact
SHA-256 and any launcher change. SHA-256 and any launcher change.
- Security fixes: when upstream ships one, the pin moves, the packaging tag - Security fixes: when upstream ships one, the pin moves, the packaging tag
@@ -124,7 +125,7 @@ is a packaging-repo feature, not an app change.
## Migration from the in-repo `windows/` folder ## Migration from the in-repo `windows/` folder
1. Create the new repo. 1. Create the new repo.
2. Copy `windows/` to its root (`build.mjs`, `launcher/`, `installer.iss`, 2. Copy `windows/` to its root (`build.mjs`, `launcher/`, `installer.nsi`,
`Dockerfile`, this plan and `README.md`), adjusting the input paths in `Dockerfile`, this plan and `README.md`), adjusting the input paths in
`build.mjs` to the fetched upstream work tree. `build.mjs` to the fetched upstream work tree.
3. Add `upstream.txt`, the CI workflow, `CHANGELOG.md`. 3. Add `upstream.txt`, the CI workflow, `CHANGELOG.md`.
+162 -11
View File
@@ -62,8 +62,11 @@ Usage: node windows/build.mjs [options]
--launcher <kind> auto (default), ps or go. "go" needs a Go toolchain and --launcher <kind> auto (default), ps or go. "go" needs a Go toolchain and
produces Luminary.exe; "ps" always works. produces Luminary.exe; "ps" always works.
--allow-dirty skip the check that the checkout is clean outside windows/ --allow-dirty skip the check that the checkout is clean outside windows/
--publish copy the finished zip to windows/releases (plus a --installer also build Luminary-<ver>-win-x64-setup.exe with NSIS
SHA256SUMS.txt) so it can be transferred to a Windows PC (fetches a private NSIS copy on Linux if makensis is absent)
--no-installer skip the setup exe even when makensis is installed
--publish copy the finished zip and setup exe to windows/releases
(plus a SHA256SUMS.txt) so they can be transferred to a PC
--webview2 <exe> ship a prebuilt LuminaryWindow.exe (native WebView2 window). --webview2 <exe> ship a prebuilt LuminaryWindow.exe (native WebView2 window).
Build it with: Build it with:
docker run --rm -v $PWD/windows/launcher:/src \\ docker run --rm -v $PWD/windows/launcher:/src \\
@@ -104,6 +107,7 @@ function parseArgs(argv) {
launcher: 'auto', launcher: 'auto',
build: true, build: true,
allowDirty: false, allowDirty: false,
installer: 'auto',
publish: false, publish: false,
webview2: null, webview2: null,
help: false, help: false,
@@ -127,6 +131,10 @@ function parseArgs(argv) {
i += 1; i += 1;
} else if (arg === '--skip-build') { } else if (arg === '--skip-build') {
options.build = false; options.build = false;
} else if (arg === '--installer') {
options.installer = 'yes';
} else if (arg === '--no-installer') {
options.installer = 'no';
} else if (arg === '--allow-dirty') { } else if (arg === '--allow-dirty') {
options.allowDirty = true; options.allowDirty = true;
} else if (arg === '--publish') { } else if (arg === '--publish') {
@@ -595,6 +603,129 @@ function writeZip(sourceDir, zipPath) {
return { files: count, bytes: statSync(zipPath).size }; return { files: count, bytes: statSync(zipPath).size };
} }
/* ------------------------------------------------------------- installer ---- */
function dirSizeBytes(dir) {
let total = 0;
for (const entry of readdirSync(dir, { withFileTypes: true })) {
const absolute = path.join(dir, entry.name);
total += entry.isDirectory() ? dirSizeBytes(absolute) : statSync(absolute).size;
}
return total;
}
function cachedMakensis(outDir) {
const root = path.join(outDir, 'tools', 'nsis');
const bin = path.join(root, 'usr', 'bin', 'makensis');
if (!existsSync(bin)) return null;
return { bin, nsisdir: path.join(root, 'usr', 'share', 'nsis') };
}
function findMakensis(outDir) {
if (process.env.MAKENSIS) {
return { bin: process.env.MAKENSIS, nsisdir: process.env.NSISDIR || null };
}
const cached = cachedMakensis(outDir);
if (cached) return cached;
const which = spawnSync(process.platform === 'win32' ? 'where' : 'which', ['makensis'], {
encoding: 'utf8',
});
const found = !which.error && which.status === 0 ? which.stdout.split(/\r?\n/)[0].trim() : '';
return found ? { bin: found, nsisdir: process.env.NSISDIR || null } : null;
}
/**
* NSIS is a small cross-compiler: on Linux it produces the same .exe as it
* would on Windows. Ubuntu ships it as two .debs, which unpack into the build
* cache without root, so a fresh host can build the installer unattended.
*/
async function fetchMakensis(outDir) {
if (process.platform !== 'linux' || process.arch !== 'x64') return null;
const dpkg = spawnSync('dpkg-deb', ['--version'], { stdio: 'ignore' });
if (dpkg.error || dpkg.status !== 0) return null;
const packVersion = '3.09-4ubuntu1';
const base = 'http://archive.ubuntu.com/ubuntu/pool/universe/n/nsis';
const debs = path.join(outDir, 'cache', 'nsis-debs');
const root = path.join(outDir, 'tools', 'nsis');
mkdirSync(debs, { recursive: true });
rmSync(root, { recursive: true, force: true });
for (const name of [`nsis_${packVersion}_amd64.deb`, `nsis-common_${packVersion}_all.deb`]) {
const file = path.join(debs, name);
if (!existsSync(file)) {
try {
writeFileSync(file, await download(`${base}/${name}`));
} catch (error) {
warn(`could not download ${name} (${error.message})`);
return null;
}
}
const unpack = spawnSync('dpkg-deb', ['-x', file, root], { encoding: 'utf8' });
if (unpack.error || unpack.status !== 0) {
warn(`could not unpack ${name}: ${(unpack.stderr || '').trim() || 'dpkg-deb failed'}`);
return null;
}
}
return cachedMakensis(outDir);
}
async function resolveMakensis(outDir, required) {
const found = findMakensis(outDir);
if (found) return found;
if (!required) return null;
log('nsis', 'makensis not found; unpacking a private NSIS into the build cache');
const fetched = await fetchMakensis(outDir);
if (fetched) {
log('nsis', `NSIS ${packVersionOf(fetched.bin)} ready (no root install needed)`);
return fetched;
}
fail(
'NSIS is required for --installer and was not found.\n' +
' Ubuntu/Debian: sudo apt install nsis\n' +
' macOS: brew install makensis\n' +
' Windows: https://nsis.sourceforge.io\n' +
' or set MAKENSIS=/path/to/makensis',
);
}
function packVersionOf(makensis) {
const result = spawnSync(makensis, ['-VERSION'], { encoding: 'utf8' });
return !result.error && result.status === 0 ? result.stdout.trim() : 'unknown version';
}
function buildInstaller({ outDir, bundle, pkg, makensis }) {
const script = path.join(HERE, 'installer.nsi');
if (!existsSync(script)) fail(`installer script missing: ${script}`);
const outputDir = path.join(outDir, 'installer');
mkdirSync(outputDir, { recursive: true });
const setup = path.join(outputDir, `Luminary-${pkg.version}-win-x64-setup.exe`);
rmSync(setup, { force: true });
// NSIS wants four numeric fields; 0.5.1 -> 0.5.1.0
const fields = pkg.version.split('.').map((n) => Number(n) || 0);
while (fields.length < 4) fields.push(0);
const version4 = fields.slice(0, 4).join('.');
const installKb = Math.ceil(dirSizeBytes(bundle) / 1024);
log('installer', `makensis ${path.basename(script)} (${(installKb / 1024).toFixed(0)} MB payload)`);
run(
makensis.bin,
[
'-V2',
`-DAPP_VERSION=${pkg.version}`,
`-DAPP_VERSION4=${version4}`,
`-DSOURCE_DIR=${bundle}`,
`-DOUTPUT_DIR=${outputDir}`,
`-DICON=${path.join(LAUNCHER_FILES, 'Luminary.ico')}`,
`-DINSTALL_KB=${installKb}`,
script,
],
ROOT,
makensis.nsisdir ? { NSISDIR: makensis.nsisdir } : undefined,
);
if (!existsSync(setup)) fail('makensis reported success but produced no setup exe');
return { path: setup, bytes: statSync(setup).size };
}
/* ----------------------------------------------------------------- main ---- */ /* ----------------------------------------------------------------- main ---- */
async function main() { async function main() {
@@ -653,9 +784,20 @@ async function main() {
rmSync(stageRoot, { recursive: true, force: true }); rmSync(stageRoot, { recursive: true, force: true });
renameSync(workRoot, stageRoot); renameSync(workRoot, stageRoot);
const stagedBundle = path.join(stageRoot, 'Luminary');
let installer = null;
if (options.installer !== 'no') {
const makensis = await resolveMakensis(options.out, options.installer === 'yes');
if (makensis) {
installer = buildInstaller({ outDir: options.out, bundle: stagedBundle, pkg, makensis });
log('installer', `${path.basename(installer.path)} (${(installer.bytes / 1024 / 1024).toFixed(1)} MB)`);
} else {
warn('makensis is not installed; shipping the zip only (install NSIS for the setup exe)');
}
}
// The isolation contract: nothing outside windows/ may have changed. // The isolation contract: nothing outside windows/ may have changed.
if (!options.allowDirty) checkRepoClean(options); if (!options.allowDirty) checkRepoClean(options);
const stagedBundle = path.join(stageRoot, 'Luminary');
// Hand-off copy. The staging and the zip stay outside the checkout; this is // Hand-off copy. The staging and the zip stay outside the checkout; this is
// the one write into the repository, into windows/releases, for transfer to a // the one write into the repository, into windows/releases, for transfer to a
@@ -663,14 +805,16 @@ async function main() {
let published = null; let published = null;
if (options.publish) { if (options.publish) {
mkdirSync(RELEASES_DIR, { recursive: true }); mkdirSync(RELEASES_DIR, { recursive: true });
const target = path.join(RELEASES_DIR, path.basename(zipPath)); const artifacts = [zipPath, ...(installer ? [installer.path] : [])];
cpSync(zipPath, target); const sums = [];
writeFileSync( for (const artifact of artifacts) {
path.join(RELEASES_DIR, 'SHA256SUMS.txt'), const target = path.join(RELEASES_DIR, path.basename(artifact));
`${sha256File(target)} ${path.basename(target)}\n`, cpSync(artifact, target);
); sums.push(`${sha256File(target)} ${path.basename(target)}`);
published = target; log('publish', path.relative(ROOT, target));
log('publish', path.relative(ROOT, target)); }
writeFileSync(path.join(RELEASES_DIR, 'SHA256SUMS.txt'), `${sums.join('\n')}\n`);
published = path.join(RELEASES_DIR, path.basename(zipPath));
} }
process.stdout.write( process.stdout.write(
@@ -680,6 +824,13 @@ async function main() {
` artifact ${zipPath}`, ` artifact ${zipPath}`,
` size ${(zip.bytes / 1024 / 1024).toFixed(1)} MB (${zip.files} files)`, ` size ${(zip.bytes / 1024 / 1024).toFixed(1)} MB (${zip.files} files)`,
` sha256 ${sha256File(zipPath)}`, ` sha256 ${sha256File(zipPath)}`,
...(installer
? [
` setup ${installer.path}`,
` setup MB ${(installer.bytes / 1024 / 1024).toFixed(1)}`,
` setup sha ${sha256File(installer.path)}`,
]
: []),
` node ${options.node} win-x64`, ` node ${options.node} win-x64`,
` launcher ${launcher === 'go' ? 'Luminary.exe' : 'Luminary.cmd / Luminary.vbs'}`, ` launcher ${launcher === 'go' ? 'Luminary.exe' : 'Luminary.cmd / Luminary.vbs'}`,
...(options.webview2 ? [` window LuminaryWindow.exe (native WebView2)`] : []), ...(options.webview2 ? [` window LuminaryWindow.exe (native WebView2)`] : []),
-90
View File
@@ -1,90 +0,0 @@
; Optional per-user installer for the Luminary Windows bundle.
;
; Build the bundle first: node windows/build.mjs
; Then, from the output directory:
; iscc /DAppVersion=0.5.1 /DSourceDir="<abs path to stage\Luminary>" \
; <repo>\windows\installer.iss
;
; The default SourceDir is relative to this script and only works when iscc is
; run with the bundle's stage folder in reach. Inno Setup 6 is required:
; https://jrsoftware.org/isinfo.php
;
; Per-user install: no UAC, no Program Files, data stays in
; %LOCALAPPDATA%\Luminary\data and is kept on uninstall.
#ifndef AppVersion
#define AppVersion "0.5.1"
#endif
#ifndef Launcher
; Luminary.cmd works even when Windows Script Host is disabled; Luminary.exe
; for the Go launcher build.
#define Launcher "Luminary.cmd"
#endif
#ifndef SourceDir
#define SourceDir "stage\Luminary"
#endif
#define AppName "Luminary"
#define AppPublisher "Maple Street"
#define AppURL "https://git.maple-street.net/bhursey/luminary"
[Setup]
AppId={{6E1B4C1E-8D6B-4F2E-9E3B-2C7A5D9F4A11}
AppName={#AppName}
AppVersion={#AppVersion}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
DefaultDirName={localappdata}\Programs\{#AppName}
DefaultGroupName={#AppName}
DisableProgramGroupPage=yes
PrivilegesRequired=lowest
ArchitecturesAllowed=x64compatible
ArchitecturesInstallIn64BitMode=x64compatible
OutputDir=installer-output
OutputBaseFilename=Luminary-{#AppVersion}-win-x64-setup
Compression=lzma2/max
SolidCompression=yes
WizardStyle=modern
UninstallDisplayName={#AppName}
SetupIconFile={#SourceDir}\Luminary.ico
; The uninstaller must not delete the catalog in %LOCALAPPDATA%\Luminary\data;
; the data folder lives outside {app} on purpose.
[Tasks]
Name: "desktopicon"; Description: "Create a desktop shortcut"; GroupDescription: "Shortcuts:"; Flags: checkedonce
Name: "startup"; Description: "Start Luminary when I sign in"; GroupDescription: "Startup:"; Flags: unchecked
[Files]
; recurses into app\, node_modules\, logs placeholders and the launcher files.
Source: "{#SourceDir}\*"; DestDir: "{app}"; Flags: recursesubdirs createallsubdirs ignoreversion
[Icons]
Name: "{group}\{#AppName}"; Filename: "{app}\{#Launcher}"; WorkingDir: "{app}"; IconFilename: "{app}\Luminary.ico"
Name: "{group}\Stop {#AppName}"; Filename: "{app}\Stop Luminary.cmd"; WorkingDir: "{app}"; IconFilename: "{app}\Luminary.ico"
Name: "{group}\{#AppName} data folder"; Filename: "%LOCALAPPDATA%\Luminary\data"
Name: "{autodesktop}\{#AppName}"; Filename: "{app}\{#Launcher}"; WorkingDir: "{app}"; Tasks: desktopicon; IconFilename: "{app}\Luminary.ico"
[Registry]
Root: HKCU; Subkey: "Software\Microsoft\Windows\CurrentVersion\Run"; ValueType: string; \
ValueName: "Luminary"; ValueData: """{app}\{#Launcher}"""; Flags: uninsdeletevalue; Tasks: startup
[Run]
Filename: "{app}\{#Launcher}"; Description: "Start Luminary now"; Flags: nowait postinstall skipifsilent
[UninstallDelete]
; Remove the program folder and its logs/runtime file. Never the data folder.
Type: filesandordirs; Name: "{app}"
[Code]
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssPostInstall then
begin
// The data folder is created by the launcher on first start; tell the user
// where it is so the "uninstall keeps my catalog" promise is obvious.
MsgBox('Luminary stores its catalog in:' + #13#10 +
ExpandConstant('{localappdata}') + '\Luminary\data' + #13#10#13#10 +
'It is not removed when you uninstall. Back it up by copying that folder '
+ 'while Luminary is stopped.', mbInformation, MB_OK);
end;
end;
+212
View File
@@ -0,0 +1,212 @@
; Per-user installer for the Luminary Windows bundle, built with NSIS 3.
;
; NSIS runs on Linux, macOS and Windows, so the same build host that produces
; the zip also produces the setup executable:
;
; node windows/build.mjs --installer --publish
;
; or by hand, from the repository root:
;
; makensis -DAPP_VERSION=0.5.1 -DAPP_VERSION4=0.5.1.0 \
; -DSOURCE_DIR="$PWD/../.cache/stage/Luminary" windows/installer.nsi
;
; Nothing is installed for all users: no UAC prompt, no Program Files. The
; program goes to %LOCALAPPDATA%\Programs\Luminary and the catalog stays in
; %LOCALAPPDATA%\Luminary\data, which the uninstaller never touches.
Unicode true
ManifestDPIAware true
ManifestSupportedOS win10
RequestExecutionLevel user
SetCompressor /SOLID lzma
SetCompressorDictSize 32
CRCCheck on
!include "MUI2.nsh"
!include "x64.nsh"
!include "WinVer.nsh"
!ifndef APP_VERSION
!define APP_VERSION "0.5.1"
!endif
; NSIS wants four numeric fields for the exe's version resource.
!ifndef APP_VERSION4
!define APP_VERSION4 "0.5.1.0"
!endif
; Forward slashes throughout: makensis is cross-platform, and this file is
; compiled on Linux as often as on Windows.
!ifndef SOURCE_DIR
!define SOURCE_DIR "${__FILEDIR__}/stage/Luminary"
!endif
!ifndef OUTPUT_DIR
!define OUTPUT_DIR "${__FILEDIR__}/installer-output"
!endif
!ifndef ICON
!define ICON "${__FILEDIR__}/launcher/Luminary.ico"
!endif
; Size of the installed tree in KB, for Add/Remove Programs. The builder
; measures the staged bundle; the fallback is roughly right for a full build.
!ifndef INSTALL_KB
!define INSTALL_KB "250000"
!endif
!define APP_NAME "Luminary"
!define APP_PUBLISHER "Maple Street"
!define APP_URL "https://git.maple-street.net/bhursey/luminary"
!define UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Luminary"
!define APP_KEY "Software\Luminary"
!define RUN_KEY "Software\Microsoft\Windows\CurrentVersion\Run"
Name "${APP_NAME} ${APP_VERSION}"
BrandingText "${APP_NAME} ${APP_VERSION}"
OutFile "${OUTPUT_DIR}/Luminary-${APP_VERSION}-win-x64-setup.exe"
InstallDir "$LOCALAPPDATA\Programs\Luminary"
InstallDirRegKey HKCU "${APP_KEY}" "InstallDir"
VIProductVersion "${APP_VERSION4}"
VIAddVersionKey "ProductName" "${APP_NAME}"
VIAddVersionKey "ProductVersion" "${APP_VERSION}"
VIAddVersionKey "FileDescription" "${APP_NAME} setup"
VIAddVersionKey "FileVersion" "${APP_VERSION}"
VIAddVersionKey "CompanyName" "${APP_PUBLISHER}"
VIAddVersionKey "LegalCopyright" "MIT licensed"
!define MUI_ICON "${ICON}"
!define MUI_UNICON "${ICON}"
!define MUI_ABORTWARNING
!define MUI_WELCOMEPAGE_TITLE "Install ${APP_NAME} ${APP_VERSION}"
!define MUI_WELCOMEPAGE_TEXT "This installs the Luminary desktop app for your Windows account.$\r$\n$\r$\nNo administrator rights are needed: the app goes in your own AppData folder, and the catalog, previews and originals index stay in %LOCALAPPDATA%\Luminary\data. Uninstalling keeps that folder so you never lose a catalog.$\r$\n$\r$\nNode.js, .NET and the Visual C++ runtime are not required - everything Luminary needs ships inside."
!define MUI_FINISHPAGE_TEXT "${APP_NAME} is installed.$\r$\n$\r$\nYour catalog lives in %LOCALAPPDATA%\Luminary\data. Back it up by copying that folder while Luminary is stopped.$\r$\n$\r$\nUninstalling removes the app but not the catalog."
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\README-windows.txt"
!define MUI_FINISHPAGE_SHOWREADME_TEXT "Show the Windows readme"
!define MUI_FINISHPAGE_SHOWREADME_NOTCHECKED
!if /FileExists "${SOURCE_DIR}/Luminary.vbs"
!define MUI_FINISHPAGE_RUN "$INSTDIR\Luminary.vbs"
!else
!define MUI_FINISHPAGE_RUN "$INSTDIR\Luminary.cmd"
!endif
!define MUI_FINISHPAGE_RUN_TEXT "Start ${APP_NAME}"
!insertmacro MUI_PAGE_WELCOME
!if /FileExists "${SOURCE_DIR}/LICENSE"
!insertmacro MUI_PAGE_LICENSE "${SOURCE_DIR}/LICENSE"
!endif
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
!insertmacro MUI_LANGUAGE "English"
LangString DESC_Main ${LANG_ENGLISH} "The editor, film looks, bundled Node runtime and documentation. Required."
LangString DESC_Desktop ${LANG_ENGLISH} "Put a Luminary shortcut on the desktop."
LangString DESC_Startup ${LANG_ENGLISH} "Start Luminary in the background when you sign in to Windows."
Function .onInit
; The launcher refuses these too, but the installer should say so before it
; copies 250 MB onto an unsupported PC.
${IfNot} ${RunningX64}
MessageBox MB_ICONSTOP "${APP_NAME} needs 64-bit Windows 10 or 11. This PC is running a 32-bit copy of Windows."
Abort
${EndIf}
${IfNot} ${AtLeastWin10}
MessageBox MB_ICONSTOP "${APP_NAME} needs Windows 10 or 11. Older versions are not supported."
Abort
${EndIf}
FunctionEnd
; Stop a copy started from this folder, so an upgrade can replace node.exe and
; app\ while it is not in use. Uses the launcher's own -Stop path, which reads
; runtime.json, rather than killing every node.exe on the machine.
!macro StopRunning
${If} ${FileExists} "$INSTDIR\Luminary.ps1"
DetailPrint "Stopping a running Luminary..."
nsExec::ExecToLog 'powershell.exe -NoProfile -ExecutionPolicy Bypass -File "$INSTDIR\Luminary.ps1" -Stop'
Pop $0
Sleep 1200
${EndIf}
!macroend
Section "Luminary (required)" SEC_MAIN
SectionIn RO
!insertmacro StopRunning
SetOutPath "$INSTDIR"
File /r "${SOURCE_DIR}/*.*"
CreateDirectory "$LOCALAPPDATA\Luminary\data"
WriteUninstaller "$INSTDIR\Uninstall.exe"
CreateDirectory "$SMPROGRAMS\Luminary"
!if /FileExists "${SOURCE_DIR}/Luminary.vbs"
CreateShortCut "$SMPROGRAMS\Luminary\Luminary.lnk" "$INSTDIR\Luminary.vbs" "" "$INSTDIR\Luminary.ico" 0
!else
CreateShortCut "$SMPROGRAMS\Luminary\Luminary.lnk" "$INSTDIR\Luminary.cmd" "" "$INSTDIR\Luminary.ico" 0
!endif
CreateShortCut "$SMPROGRAMS\Luminary\Stop Luminary.lnk" "$INSTDIR\Stop Luminary.cmd" "" "$INSTDIR\Luminary.ico" 0
CreateShortCut "$SMPROGRAMS\Luminary\Luminary data folder.lnk" "$LOCALAPPDATA\Luminary\data" "" "$INSTDIR\Luminary.ico" 0
WriteRegStr HKCU "${APP_KEY}" "InstallDir" "$INSTDIR"
WriteRegStr HKCU "${APP_KEY}" "Version" "${APP_VERSION}"
WriteRegStr HKCU "${UNINST_KEY}" "DisplayName" "${APP_NAME}"
WriteRegStr HKCU "${UNINST_KEY}" "DisplayVersion" "${APP_VERSION}"
WriteRegStr HKCU "${UNINST_KEY}" "Publisher" "${APP_PUBLISHER}"
WriteRegStr HKCU "${UNINST_KEY}" "URLInfoAbout" "${APP_URL}"
WriteRegStr HKCU "${UNINST_KEY}" "DisplayIcon" "$INSTDIR\Luminary.ico"
WriteRegStr HKCU "${UNINST_KEY}" "InstallLocation" "$INSTDIR"
WriteRegStr HKCU "${UNINST_KEY}" "UninstallString" '"$INSTDIR\Uninstall.exe"'
WriteRegStr HKCU "${UNINST_KEY}" "QuietUninstallString" '"$INSTDIR\Uninstall.exe" /S'
WriteRegDWORD HKCU "${UNINST_KEY}" "EstimatedSize" ${INSTALL_KB}
WriteRegDWORD HKCU "${UNINST_KEY}" "NoModify" 1
WriteRegDWORD HKCU "${UNINST_KEY}" "NoRepair" 1
SectionEnd
Section "Desktop shortcut" SEC_DESKTOP
!if /FileExists "${SOURCE_DIR}/Luminary.vbs"
CreateShortCut "$DESKTOP\Luminary.lnk" "$INSTDIR\Luminary.vbs" "" "$INSTDIR\Luminary.ico" 0
!else
CreateShortCut "$DESKTOP\Luminary.lnk" "$INSTDIR\Luminary.cmd" "" "$INSTDIR\Luminary.ico" 0
!endif
SectionEnd
Section "Start Luminary when I sign in" SEC_STARTUP
!if /FileExists "${SOURCE_DIR}/Luminary.vbs"
WriteRegStr HKCU "${RUN_KEY}" "Luminary" '"$INSTDIR\Luminary.vbs"'
!else
WriteRegStr HKCU "${RUN_KEY}" "Luminary" '"$INSTDIR\Luminary.cmd"'
!endif
SectionEnd
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_MAIN} $(DESC_Main)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_DESKTOP} $(DESC_Desktop)
!insertmacro MUI_DESCRIPTION_TEXT ${SEC_STARTUP} $(DESC_Startup)
!insertmacro MUI_FUNCTION_DESCRIPTION_END
Section "Uninstall"
!insertmacro StopRunning
Delete "$SMPROGRAMS\Luminary\Luminary.lnk"
Delete "$SMPROGRAMS\Luminary\Stop Luminary.lnk"
Delete "$SMPROGRAMS\Luminary\Luminary data folder.lnk"
RMDir "$SMPROGRAMS\Luminary"
Delete "$DESKTOP\Luminary.lnk"
DeleteRegValue HKCU "${RUN_KEY}" "Luminary"
DeleteRegKey HKCU "${UNINST_KEY}"
DeleteRegKey HKCU "${APP_KEY}"
; %LOCALAPPDATA%\Luminary\data is deliberately outside $INSTDIR, so this
; only removes the program, its logs and its runtime marker.
RMDir /r "$INSTDIR"
IfSilent uninstallDone
MessageBox MB_ICONINFORMATION|MB_OK "${APP_NAME} was removed.$\r$\n$\r$\nYour catalog in $LOCALAPPDATA\Luminary\data was kept: delete that folder yourself if you no longer want it."
uninstallDone:
SectionEnd
+4 -3
View File
@@ -6,9 +6,10 @@ app never looks in this folder.
| File | What to do with it | | File | What to do with it |
| --- | --- | | --- | --- |
| `Luminary-<version>-win-x64.zip` | Copy to the Windows PC, right-click → **Extract All…**, then run `Luminary.cmd` (or `Luminary.vbs`) from the extracted `Luminary` folder. `README-windows.txt` inside the zip is the end-user guide. | | `Luminary-<version>-win-x64-setup.exe` | Copy to the Windows PC and run it. Per-user install, no admin prompt: Start-menu shortcuts, optional desktop shortcut and start-at-login, and an uninstaller that keeps `%LOCALAPPDATA%\Luminary\data`. |
| `Luminary-<version>-win-x64.zip` | The portable alternative: extract, then run `Luminary.cmd` (or `Luminary.vbs`) from the extracted `Luminary` folder. `README-windows.txt` inside the zip is the end-user guide. |
| `LuminaryWindow.exe` inside the zip | optional native window (WebView2); the launcher uses it automatically when present, and starting it directly forwards to the launcher | | `LuminaryWindow.exe` inside the zip | optional native window (WebView2); the launcher uses it automatically when present, and starting it directly forwards to the launcher |
| `SHA256SUMS.txt` | Check the copy did not corrupt: `certutil -hashfile Luminary-<version>-win-x64.zip SHA256` | | `SHA256SUMS.txt` | Check a copy did not corrupt: `certutil -hashfile Luminary-<version>-win-x64-setup.exe SHA256` |
## Rebuilding this folder ## Rebuilding this folder
@@ -17,7 +18,7 @@ node windows/build.mjs --publish # npm run build, then bundle + copy
node windows/build.mjs --skip-build --publish # reuse the existing dist/ node windows/build.mjs --skip-build --publish # reuse the existing dist/
``` ```
`--publish` copies the finished zip and writes `SHA256SUMS.txt`. The build still `--publish` copies the finished zip, the setup exe and `SHA256SUMS.txt`. The build still
stages and zips **outside** the checkout (`~/.cache/luminary-windows`, or stages and zips **outside** the checkout (`~/.cache/luminary-windows`, or
`%LOCALAPPDATA%\Luminary\build` on Windows); this folder only receives the final `%LOCALAPPDATA%\Luminary\build` on Windows); this folder only receives the final
artifact. Old versions are not deleted, so remove the ones you no longer ship. artifact. Old versions are not deleted, so remove the ones you no longer ship.
+2 -1
View File
@@ -1 +1,2 @@
644c4e60451466e69d16860a9d1be509acc204168fb30bcd3f4f6b75ba24d922 Luminary-0.5.1-win-x64.zip 22b8943d1ca3bed3ef115530831947e4e03f6a45317ec6b35c10e871fad22a9a Luminary-0.5.1-win-x64.zip
b33e3d8b595aa3ff20b0898f3adea639e02afe9eb54c4fba5dd09ec07e041a0c Luminary-0.5.1-win-x64-setup.exe