feat(#16): one-command setup script + Makefile + friendly env validation#133
Closed
georgyia wants to merge 3 commits into
Closed
feat(#16): one-command setup script + Makefile + friendly env validation#133georgyia wants to merge 3 commits into
georgyia wants to merge 3 commits into
Conversation
…ation - scripts/setup.sh: prereq checks (Node 20+, Docker, optional Stripe CLI), .env bootstrap with interactive prompts, waits for Postgres + Redis readiness, runs npm install, prisma generate, migrate deploy, and seed. Supports --yes/--skip-seed/CI=true for unattended runs. - Makefile: thin wrappers around npm scripts + setup.sh (make help lists all common dev tasks). - src/config/env.ts: Zod-based aggregate validation; missing/invalid vars print a single human-readable block and exit(1) instead of a stack trace. Exports validateEnv/envSchema for unit testing. - .env.example: document NODE_ENV and PAYMENT_PROVIDER. - README: lead with ./scripts/setup.sh (manual steps kept as fallback), link make help. - tests/unit/config/env.test.ts: covers defaults, coercions, aggregate error reporting, and regex validation. Closes #16
ESLint's no-undef rule flags `NodeJS.ProcessEnv` as undefined under the repo's globals config (globals.node doesn't expose the NodeJS namespace), and `fail()` is no longer a Jest global in newer @types/jest. - src/config/env.ts: replace `NodeJS.ProcessEnv` with `Record<string, string | undefined>` — equivalent shape, no namespace. - tests/unit/config/env.test.ts: alias the same shape locally; rewrite the malformed-URL test with a try/catch so it no longer depends on Jest's removed `fail()` global. Lint now passes with 0 errors (pre-existing `no-explicit-any` warnings unchanged). All 6 env unit tests still pass.
JonasBaeumer
left a comment
Owner
There was a problem hiding this comment.
Note: this might be conflicting with the approach / code PR in #111
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Closes #16.
Gets a fresh clone running with a single command and replaces stack-trace crashes on missing env vars with a readable error block.
scripts/setup.shwalks through prereq checks (Node 20+, Docker, optional Stripe CLI), bootstraps.env, boots Postgres + Redis via docker compose and waits for readiness, runsnpm install,prisma generate,prisma migrate deploy, andnpm run seed. Supports--yes,--skip-seed, and picks upCI=truefor unattended runs.Makefilewraps the common dev flows (setup,dev,worker,test,test-integration,migrate,seed,reset,lint,format,build,infra,clean) withmake help.src/config/env.tsis rewritten around a Zod schema. Missing/invalid values now print a single block listing exactly what is wrong (one bullet per issue) andprocess.exit(1)— no stack trace../scripts/setup.sh; the manual steps are preserved as a collapsible fallback..env.examplegains explicitNODE_ENVandPAYMENT_PROVIDERentries.Test plan
npm test(361 unit tests pass, incl. 6 new cases intests/unit/config/env.test.tscovering defaults, coercion, malformed URLs, invalid LOG_LEVEL, and aggregate error formatting)../scripts/setup.sh --yes --skip-seedon the running stack completes end-to-end.make helprenders all targets;make testdelegates correctly.Acceptance checklist (from the issue)
./scripts/setup.shruns end-to-end on a clean clone (macOS verified; bash-only, Linux-compatible syntax).