diff options
Diffstat (limited to 'packaging/win/build-win-light.ps1')
| -rw-r--r-- | packaging/win/build-win-light.ps1 | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/packaging/win/build-win-light.ps1 b/packaging/win/build-win-light.ps1 new file mode 100644 index 0000000..5a8a06e --- /dev/null +++ b/packaging/win/build-win-light.ps1 @@ -0,0 +1,85 @@ +<# +.SYNOPSIS + Build the Windows "Light" installer: Electron client + UI only, no + bundled node. + +.DESCRIPTION + The counterpart of build-win.ps1 (Full) for anyone who only wants to + *use* MeshBay -- join groups, chat, browse, download, stream, cast -- + without ever hosting content from this machine. See + C:\Users\admin\devel\light-client.md for the evaluation this + implements: a member never needs a local node to begin with (identity + keys are per node -- the *host's* node, not the joiner's), so Light is + the existing browser-only usage pattern wrapped in the Electron shell, + minus the frozen meshbay-node.exe / ffmpeg / autostart bundle. + + Steps 1-4 are identical to build-win.ps1 (build-win-common.ps1). Step 5, + PyInstaller freezing a node runtime, does not happen at all -- that is + the entire point of this target. Step 6 hands electron-builder a + standalone config (electron-builder.light.yml) instead of package.json's + `build` field: passing --config makes electron-builder read ONLY that + file (see app-builder-lib/out/util/config/load.js's getConfig -- when a + config path is given, package.json's own `build` field is never loaded, + so there is no array-merge ambiguity to worry about between the two + targets' very different extraResources). + + Output: packages/meshbay-client/dist-light/MeshBay Light-Setup-<version>.exe + (a different output directory from Full's dist/, so the two builds never + race on the same files). + +.PARAMETER NoElectronBump + Keep the pinned Electron instead of upgrading to the latest release. +#> +[CmdletBinding()] +param( + [switch]$NoElectronBump +) + +$ErrorActionPreference = "Stop" +Set-StrictMode -Version Latest + +$WinDir = $PSScriptRoot +$Repo = (Resolve-Path (Join-Path $WinDir "..\..")).Path +$Client = Join-Path $Repo "packages\meshbay-client" +$Config = Join-Path $WinDir "electron-builder.light.yml" + +. (Join-Path $WinDir "build-win-common.ps1") + +if (-not (Test-Path $Config)) { throw "missing $Config" } + +# --- 1. Node ------------------------------------------------------------- +Assert-NodeVersion + +Push-Location $Client +try { + # --- 2. deps ------------------------------------------------------ + Invoke-NpmCi + + # --- 3. Electron: build against the latest release -------------- + Invoke-ElectronBump -NoElectronBump:$NoElectronBump -WinDir $WinDir + + # --- 4. UI ----------------------------------------------------- + Invoke-SyncUi + + # --- 5. (no node runtime -- that is what makes this "Light") ----- + + # --- 6. installer --------------------------------------- + Step "electron-builder --win nsis --config electron-builder.light.yml" + & npx electron-builder --win nsis --config $Config + if ($LASTEXITCODE -ne 0) { throw "electron-builder failed" } +} +finally { + Pop-Location +} + +$setup = Get-ChildItem (Join-Path $Client "dist-light") -Filter "*Setup*.exe" -ErrorAction SilentlyContinue | + Sort-Object LastWriteTime | Select-Object -Last 1 +Write-Host "" +if ($setup) { + Write-Host "OK installer: $($setup.FullName)" -ForegroundColor Green + Write-Host (" ({0:N0} MB)" -f ($setup.Length / 1MB)) +} +else { + Write-Host "!! no *Setup*.exe found in $Client\dist-light" -ForegroundColor Red + exit 1 +} |