Feature 01 task 3: Embed the PWA build with SPA fallback (#4)

Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
Co-committed-by: dev_agent <dev_agent@cubecraftlabs.com>
This commit was merged in pull request #4.
This commit is contained in:
2026-10-02 22:47:01 -04:00
committed by approver_agent
parent f0b2696059
commit 85569b451f
8 changed files with 451 additions and 21 deletions
+24
View File
@@ -0,0 +1,24 @@
# Build entry point: build the PWA, embed it, then build the server binary.
FRONTEND_DIST := internal/frontend/dist
.PHONY: build web embed check-embed-clean
build: embed
go build -o bin/mealquest ./cmd/server
web:
cd web && npm ci && npm run build
# Replace the committed placeholder with the built PWA so go:embed picks it up.
# Recreate the whole directory: a glob would skip dotfiles, which all:dist embeds.
embed: web
rm -rf $(FRONTEND_DIST)
mkdir -p $(FRONTEND_DIST)
cp -R web/dist/. $(FRONTEND_DIST)/
# Regression check: a stale hidden file must not survive an embed.
check-embed-clean:
touch $(FRONTEND_DIST)/.stale-embed-check
$(MAKE) embed
test ! -e $(FRONTEND_DIST)/.stale-embed-check