diff options
Diffstat (limited to 'packaging/win/build-win.ps1')
| -rw-r--r-- | packaging/win/build-win.ps1 | 43 |
1 files changed, 13 insertions, 30 deletions
diff --git a/packaging/win/build-win.ps1 b/packaging/win/build-win.ps1 index 0a30ad5..ea54c6f 100644 --- a/packaging/win/build-win.ps1 +++ b/packaging/win/build-win.ps1 @@ -9,13 +9,18 @@ meshbay-node daemon. No hub -- a desktop machine installs client + node (+ common, which is inside the node runtime). + This is the "Full" target. See build-win-light.ps1 for "Light" (client + + UI only, no bundled node) -- steps 1-4 below live in build-win-common.ps1, + shared by both, so they cannot drift apart. + Steps: 1. Node >= 22 check 2. npm ci (+ approve Electron's install script, download Chromium) 3. bump Electron to the latest release (Chromium CVE policy -- see build-client.sh; skip with -NoElectronBump) 4. npm run sync-ui (copy the interface from the hub package) - 5. build-node-runtime.ps1 (PyInstaller freeze of the daemon) + 5. build-node-runtime.ps1 (PyInstaller freeze of the daemon) -- Light + skips this step entirely, which is the whole difference 6. electron-builder --win nsis .PARAMETER SkipFfmpeg @@ -44,45 +49,23 @@ $WinDir = $PSScriptRoot $Repo = (Resolve-Path (Join-Path $WinDir "..\..")).Path $Client = Join-Path $Repo "packages\meshbay-client" -function Step($msg) { Write-Host "==> $msg" -ForegroundColor Cyan } +. (Join-Path $WinDir "build-win-common.ps1") # --- 1. Node ------------------------------------------------------------- -if (-not (Get-Command node -ErrorAction SilentlyContinue)) { - throw "Node.js not found. Install Node 22 or newer from nodejs.org." -} -$nodeMajor = [int](& node -e "process.stdout.write(String(process.versions.node.split('.')[0]))") -if ($nodeMajor -lt 22) { throw "Node $nodeMajor is too old -- need 22 or newer for Electron" } -Step "Node $(& node --version)" +Assert-NodeVersion Push-Location $Client try { # --- 2. deps ------------------------------------------------------ - Step "npm ci" - & npm ci --ignore-scripts - if ($LASTEXITCODE -ne 0) { throw "npm ci failed" } + Invoke-NpmCi # --- 3. Electron: build against the latest release -------------- - # Writes package.json + package-lock.json, so the build leaves the repo - # dirty on purpose -- commit the new pin. - if (-not $NoElectronBump) { - Step "checking for a newer Electron" - $bumped = & node (Join-Path $WinDir "bump-electron.mjs") - if ($LASTEXITCODE -ne 0) { throw "electron bump failed" } - if ($bumped) { - Write-Host " Electron -> $bumped (package.json + lock updated, commit them)" -ForegroundColor Yellow - } else { - Write-Host " Electron is already current" - } - } - - Step "downloading Electron's Chromium" - & npm approve-scripts electron 2>$null - & node node_modules/electron/install.js + # Writes package.json + package-lock.json when it bumps something, so the + # build leaves the repo dirty on purpose -- commit the new pin. + Invoke-ElectronBump -NoElectronBump:$NoElectronBump -WinDir $WinDir # --- 4. UI ----------------------------------------------------- - Step "npm run sync-ui" - & npm run sync-ui - if ($LASTEXITCODE -ne 0) { throw "sync-ui failed" } + Invoke-SyncUi # --- 5. node runtime --------------------------------------- $rtExe = Join-Path $Client "node-runtime\meshbay-node.exe" |