feat(cli): integrate @cedarjs/pg for local Postgres in dev and test - #2283
feat(cli): integrate @cedarjs/pg for local Postgres in dev and test#2283simoncrypta wants to merge 19 commits into
Conversation
Add setup/create-app overlay and CLI/testing hooks so CEDAR_PG=1 ensures per-worktree DBs, keeps them across cedar dev, and disposes after tests.
Ignore .cedar-pg/* in app templates, fixtures, and setup; point the local test app at a sibling cedar-pg checkout with postgres + CEDAR_PG=1.
Delegate skip policy so stale cpg_* URLs always re-ensure instead of being treated as an external DATABASE_URL.
Switch Cedar CLI/testing bridges to cedar-pg ensureIfNeeded, and only load .cedar-pg/test.env for Jest workers when provisioning actually ran.
👷 Deploy request for cedarjs pending review.Visit the deploys page to approve it
|
|
| Command | Status | Duration | Result |
|---|---|---|---|
nx run-many -t build:pack --exclude create-ceda... |
✅ Succeeded | 2s | View ↗ |
nx run-many -t build |
✅ Succeeded | <1s | View ↗ |
nx run-many -t build --output-style=stream |
✅ Succeeded | 2m 39s | View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-08-05 16:02:58 UTC
Use the published @cedarjs/pg@alpha package instead of a local cedar-pg file: dependency for setup, create-app, and local testing.
Telemetry/update-check spawns were splitting paths that contain spaces (e.g. CI's "test project"), producing MODULE_NOT_FOUND for a truncated path. Also pipe Playwright webServer stderr for clearer smoke failures.
Apply MSVC CommandLineToArgvW rules so backslashes before quotes are escaped correctly when spawning background processes with shell: true.
Babysit statusMetadata is in good shape ( CI is green on the cedar-pg / fixture / CodeQL / main smoke paths. Remaining failures on the latest run look like known Windows flakes unrelated to this PR’s feature work:
Fork PRs can’t |
Adopt @cedarjs/pg 0.2.0-alpha (acquireIfNeeded, .cedarpg, Jest test-env setupFiles) so framework hosts match the published lifecycle and worker env contract.
Extract prepareApiTestDatabase and cedarPgLifecycle so Jest/Vitest share one acquire/dispose path, optionalize globalTeardown, and drop redundant DATABASE_URL env spreads from cedar dev.
Fold main's provider/URL mismatch checks into prepareApiTestDatabase and keep cedar-pg lifecycle exports alongside checkTestDatabase.
…g PR Move background process shell quoting and smoke stderr piping to a separate draft PR. Restore deploy-simplification proseWrap noise and fix .prettierignore to use .cedarpg.

Summary
yarn cedar setup cedar-pgandcreate-cedar-app --db cedar-pgto provision worktree-isolated local Postgres via@cedarjs/pg@alpha+ autopg@cedarjs/pgintocedar devand api test setups (Jest/Vitest) whenCEDAR_PG=1Test plan
yarn cedar setup cedar-pginstalls@cedarjs/pg@alphaand configures Postgres/PrismaPgCEDAR_PG=1,yarn cedar devensures a worktree DB and injectsDATABASE_URLCEDAR_PG=1DATABASE_URL/TEST_DATABASE_URLescape hatch still skips ensure (unlessCEDAR_PG_FORCE=1)