OpenDataVisualizer/run.ps1
Claudio Schaad 6a6b3a88c5 Add dataset docs, source credits and run script (#4)
- docs/datasets.md: overview of all sources with Mermaid diagrams, plus
  one page per dataset in docs/datasets/ (source, licence, fetch,
  refresh, cache, flowchart)
- CLAUDE.md: mandatory rule to keep the dataset docs up to date
- Map footers credit title, publisher and licence link of every source
  as required by CC BY 4.0, plus swisstopo and the processing applied
- run.ps1 builds the client and starts the server

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: Claudio Schaad <c.schaad@pog.ch>
Co-committed-by: Claudio Schaad <c.schaad@pog.ch>
2026-11-09 18:17:33 +00:00

52 lines
1.5 KiB
PowerShell

<#
.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