$ErrorActionPreference = "Stop" Set-Location (Split-Path $PSScriptRoot -Parent) function Step([string]$Name, [scriptblock]$Command) { Write-Host "==> $Name" -ForegroundColor Cyan & $Command if ($LASTEXITCODE -ne 0) { throw "$Name failed (exit code $LASTEXITCODE)" } } foreach ($tool in "node", "pnpm", "py") { if (-not (Get-Command $tool -ErrorAction SilentlyContinue)) { throw "$tool was not found. See docs/building-windows.md for the tools to install." } } Step "Installing packages" { pnpm install } Step "Building the downloader" { py -3 scripts\build_downloader.py } Step "Installing the castLabs signing tool" { venv\Scripts\python.exe -m pip install -q --upgrade castlabs-evs } $env:EVS_PYTHON = (Resolve-Path "venv\Scripts\python.exe").Path Step "Checking the castLabs account" { venv\Scripts\python.exe -m castlabs_evs.account reauth } Step "Building the app pages" { pnpm vite build } Step "Building the app" { pnpm build:electron } Step "Creating the installer" { pnpm exec electron-builder --win nsis --x64 -c.directories.output=release/windows } $installer = Get-ChildItem release\windows -Filter "*.exe" | Sort-Object LastWriteTime -Descending | Select-Object -First 1 Write-Host "" Write-Host "Installer: $($installer.FullName)" -ForegroundColor Green