#Requires -Version 5.1 <# .SYNOPSIS Erstellt ein Production-Bundle unter dist/ (ohne Branch-Wechsel). #> [CmdletBinding()] param( [switch]$InPlace ) $ErrorActionPreference = "Stop" $Root = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path $BuildDir = Join-Path $Root "scripts\build" function Resolve-NodeTool([string]$ToolName) { $command = Get-Command $ToolName -ErrorAction SilentlyContinue if ($command) { return $command.Source } $candidates = @( (Join-Path $env:ProgramFiles "nodejs\$ToolName.cmd"), (Join-Path ${env:ProgramFiles(x86)} "nodejs\$ToolName.cmd") ) foreach ($candidate in $candidates) { if (Test-Path $candidate) { return $candidate } } return $null } $npm = Resolve-NodeTool "npm" if (-not $npm) { throw "npm nicht gefunden. Bitte Node.js installieren." } Set-Location $BuildDir & $npm ci --no-fund --no-audit if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } if ($InPlace) { & $npm run build:in-place } else { & $npm run build } exit $LASTEXITCODE