27 lines
1.1 KiB
PowerShell
27 lines
1.1 KiB
PowerShell
$root = Split-Path -Parent $PSScriptRoot
|
|
$webDir = Join-Path $root "web"
|
|
$outputDir = Join-Path $root "build"
|
|
$deployDir = Join-Path $root "deploy"
|
|
|
|
Write-Host "Building Web frontend..." -ForegroundColor Cyan
|
|
Push-Location $webDir
|
|
& "pnpm" build 2>&1 | Select-String -NotMatch "pnpm"
|
|
$buildOk = $LASTEXITCODE
|
|
Pop-Location
|
|
if ($buildOk -ne 0) { exit 1 }
|
|
|
|
Write-Host "Packaging..." -ForegroundColor Cyan
|
|
Remove-Item -Recurse -Force "$deployDir\.next" -ErrorAction SilentlyContinue
|
|
Copy-Item -Recurse "$webDir\.next\*" "$deployDir\.next\" -Exclude "cache"
|
|
Copy-Item -Recurse "$webDir\public\*" "$deployDir\public\" -ErrorAction SilentlyContinue
|
|
Copy-Item "$webDir\package.json" "$deployDir\"
|
|
Copy-Item "$webDir\next.config.ts" "$deployDir\"
|
|
Copy-Item "$webDir\pnpm-lock.yaml" "$deployDir\"
|
|
|
|
$zipPath = "$outputDir\inchstep-web-deploy.zip"
|
|
Remove-Item $zipPath -Force -ErrorAction SilentlyContinue
|
|
Compress-Archive -Path "$deployDir\*" -DestinationPath $zipPath
|
|
|
|
$size = (Get-Item $zipPath).Length / 1MB
|
|
Write-Host "OK: build/inchstep-web-deploy.zip ($([math]::Round($size,1)) MB)" -ForegroundColor Green
|