<# .SYNOPSIS Builds the client and starts the OpenDataVisualizer server on http://localhost:5080. .PARAMETER SkipClient Does not rebuild the client; the server serves the existing build in Schaad.OpenData.Server/wwwroot. .PARAMETER Install Runs "npm ci" before building, also when client/node_modules already exists. .EXAMPLE .\run.ps1 .\run.ps1 -SkipClient #> param( [switch]$SkipClient, [switch]$Install ) $ErrorActionPreference = 'Stop' $root = $PSScriptRoot $client = Join-Path $root 'client' $server = Join-Path $root 'Schaad.OpenData.Server' function Invoke-Step([string]$Title, [scriptblock]$Command) { Write-Host "==> $Title" -ForegroundColor Cyan & $Command if ($LASTEXITCODE -ne 0) { throw "$Title failed (exit code $LASTEXITCODE)" } } $running = Get-Process -Name 'Schaad.OpenData.Server' -ErrorAction SilentlyContinue if ($running) { throw "The server is already running (PID $($running.Id -join ', ')). Stop it first, otherwise the build fails on locked files." } if (-not $SkipClient) { Push-Location $client try { if ($Install -or -not (Test-Path (Join-Path $client 'node_modules'))) { Invoke-Step 'Installing client packages' { npm ci } } Invoke-Step 'Building client into Schaad.OpenData.Server/wwwroot' { npm run build } } finally { Pop-Location } } Write-Host '==> Starting server on http://localhost:5080 (Ctrl+C to stop)' -ForegroundColor Cyan dotnet run --project $server --launch-profile http