fix windows build

This commit is contained in:
matei jordache
2026-03-24 17:42:21 -07:00
parent 76f496fc2c
commit cfd244e56a
6 changed files with 27 additions and 1 deletions

View File

@@ -5,6 +5,28 @@ param(
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
function Assert-LastExitCode {
param(
[Parameter(Mandatory = $true)]
[string]$Step
)
if ($LASTEXITCODE -ne 0) {
if ($Step -eq "Frontend build") {
Write-Host ""
Write-Host "Frontend build failed, so desktop packaging was stopped on purpose." -ForegroundColor Yellow
Write-Host "This prevents packaging a stale frontend\\dist into the Windows app." -ForegroundColor Yellow
Write-Host ""
Write-Host "Next checks:" -ForegroundColor Yellow
Write-Host " 1. Run: npm run build" -ForegroundColor Yellow
Write-Host " 2. If you see 'spawn EPERM', try Node 20 LTS instead of Node 24." -ForegroundColor Yellow
Write-Host " 3. Reinstall frontend deps on Windows: npm --prefix frontend install" -ForegroundColor Yellow
Write-Host ""
}
throw "$Step failed with exit code $LASTEXITCODE."
}
}
$repoRoot = Split-Path -Parent $PSScriptRoot
Set-Location $repoRoot
@@ -18,9 +40,11 @@ $demoDir = Join-Path $repoRoot "demo"
Write-Host "Building frontend bundle..."
npm run build
Assert-LastExitCode "Frontend build"
Write-Host "Installing desktop build dependencies..."
& $pythonExe -m pip install -e ".[desktop]"
Assert-LastExitCode "Desktop dependency installation"
$mode = if ($OneFile) { "--onefile" } else { "--onedir" }
@@ -40,11 +64,13 @@ $pyInstallerArgs = @(
"--collect-all", "matplotlib",
"--collect-all", "scipy",
"--collect-all", "skimage",
"--collect-all", "webview"
"--collect-all", "webview",
"--icon", "../resources/icon.ico"
)
Write-Host "Packaging desktop app..."
& $pythonExe @pyInstallerArgs
Assert-LastExitCode "PyInstaller packaging"
Write-Host "Desktop build complete."
Write-Host "Output folder: $repoRoot\desktop-dist\argonode"