From 1d0842cc013cc5637dae8bc3d44e607b4e843e7c Mon Sep 17 00:00:00 2001 From: brunorezio Date: Sun, 26 Jul 2026 01:47:54 +0100 Subject: [PATCH] setup.sh: generate index.gen.html and apply the schema A fresh clone has neither: index.gen.html is gitignored and built from PUBLIC_URL, and the database schema is applied with push rather than migrations. Without both, setup finishes on a checkout that cannot serve a page or reach a table. Runs after .env is written, since both depend on it. Failures warn rather than abort so the rest of the verification still reports. Co-Authored-By: Claude Opus 5 --- scripts/setup.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/scripts/setup.sh b/scripts/setup.sh index e020d253..ce783b6c 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -879,6 +879,30 @@ else esac fi +# ─── 18. project initialization ────────────────────────────────────────────── +echo "" +echo "── Project initialization ──" + +if ! has bun || [ ! -f "$PROJECT_DIR/.env" ]; then + warn "Skipping project initialization (bun or .env missing)" +else + # index.gen.html is gitignored and built from .env, so it does not exist on a fresh clone. + echo " Generating index.gen.html from PUBLIC_URL..." + if (cd "$PROJECT_DIR" && bun run gen:index); then + ok "index.gen.html generated" + else + fail "gen:index failed — the app will not serve until this succeeds" + fi + + # Officer applies its schema with push; there are no migrations to run. + echo " Applying database schema..." + if (cd "$PROJECT_DIR" && bun db:push); then + ok "database schema applied" + else + fail "db:push failed — check POSTGRES_URL in .env and that Postgres is reachable" + fi +fi + # ─── verification ───────────────────────────────────────────────────────────── echo "" echo "═══════════════════════════════════════════"