aboutsummaryrefslogtreecommitdiff
path: root/scripts/build-prod.ps1
blob: b4c7107c164b8e8e701486d9eca1db9a0cc081cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/env pwsh
$ErrorActionPreference = "Stop"
$ROOT = Split-Path -Parent $PSScriptRoot

Write-Host "=== Building YAUM single binary ===" -ForegroundColor Green
Write-Host ""

Write-Host "1. Building frontend..." -ForegroundColor Yellow
Set-Location "$ROOT/frontend"
npm ci
npm run build

Write-Host ""
Write-Host "2. Copying frontend build to Go embed directory..." -ForegroundColor Yellow
Remove-Item -Path "$ROOT/backend/internal/static/build" -Recurse -Force -ErrorAction SilentlyContinue
Copy-Item -Path "$ROOT/frontend/build" -Destination "$ROOT/backend/internal/static/build" -Recurse -Force

Write-Host ""
Write-Host "3. Building Go binary..." -ForegroundColor Yellow
Set-Location "$ROOT/backend"
go build -o yaum.exe ./cmd/server/

Write-Host ""
Write-Host "=== Done! Binary at backend\yaum.exe ===" -ForegroundColor Green
Write-Host ""
Write-Host "Run with:" -ForegroundColor Cyan
Write-Host "  cd backend && .\yaum.exe" -ForegroundColor White