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 "═══════════════════════════════════════════"