Files
ForgeFlow/build-windows.ps1
T
2026-07-24 20:29:23 +02:00

59 lines
1.7 KiB
PowerShell

$ErrorActionPreference = "Stop"
Set-StrictMode -Version Latest
Set-Location $PSScriptRoot
function Assert-Command {
param([Parameter(Mandatory = $true)][string]$Name)
if (-not (Get-Command $Name -ErrorAction SilentlyContinue)) {
throw "Required command '$Name' was not found on PATH. Read START_HERE.md for prerequisites."
}
}
function Invoke-Step {
param(
[Parameter(Mandatory = $true)][string]$Title,
[Parameter(Mandatory = $true)][scriptblock]$Action
)
Write-Host "`n$Title" -ForegroundColor Yellow
& $Action
if ($LASTEXITCODE -ne 0) {
throw "$Title failed with exit code $LASTEXITCODE."
}
}
Write-Host "ForgeFlow v0.4.2 Windows development build" -ForegroundColor Cyan
Write-Host "Artifacts are unsigned and intended for local testing." -ForegroundColor DarkGray
Assert-Command node
Assert-Command npm
Assert-Command git
$nodeVersionText = (node --version).Trim()
$nodeMajor = [int]($nodeVersionText.TrimStart('v').Split('.')[0])
if ($nodeMajor -lt 22) {
throw "Node.js 22 or newer is required. Detected: $nodeVersionText"
}
Invoke-Step "Installing exact project dependencies..." {
if (Test-Path ".\package-lock.json") {
npm ci --no-audit --no-fund
} else {
npm install --no-audit --no-fund
}
}
Invoke-Step "Running the environment doctor..." {
npm run doctor
}
Invoke-Step "Running the release quality gate..." {
npm run check
}
Invoke-Step "Building NSIS installer and portable package..." {
npm run dist:win
}
Write-Host "`nBuild complete. Artifacts are available in .\dist" -ForegroundColor Green
Get-ChildItem -Path .\dist -File | Select-Object Name, Length, LastWriteTime