Files
garage/scripts/build-frontend.sh
2026-08-06 19:00:08 +12:00

21 lines
700 B
Bash
Executable File

#!/usr/bin/env bash
# Builds the Svelte SPA and copies it into the Go binary's embed directory.
# The Dockerfile does the equivalent as part of the image build; use this
# script when building/running the Go binary directly on your machine.
set -euo pipefail
cd "$(dirname "${BASH_SOURCE[0]}")/.."
echo "==> Installing frontend dependencies"
(cd frontend && npm install)
echo "==> Building frontend"
(cd frontend && npm run build)
echo "==> Copying build into backend/cmd/server/web"
mkdir -p backend/cmd/server/web
find backend/cmd/server/web -mindepth 1 ! -name '.gitkeep' -delete
cp -r frontend/dist/. backend/cmd/server/web/
echo "==> Done. You can now: cd backend && go build ./cmd/server"