Skip to content

feat(cli): setup neon#1762

Merged
Tobbe merged 10 commits into
mainfrom
tobbe-feat-cli-setup-neon
May 13, 2026
Merged

feat(cli): setup neon#1762
Tobbe merged 10 commits into
mainfrom
tobbe-feat-cli-setup-neon

Conversation

@Tobbe
Copy link
Copy Markdown
Member

@Tobbe Tobbe commented May 12, 2026

Add setup command for using a new Neon Postgres database

@netlify
Copy link
Copy Markdown

netlify Bot commented May 12, 2026

Deploy Preview for cedarjs ready!

Name Link
🔨 Latest commit a2b8b99
🔍 Latest deploy log https://app.netlify.com/projects/cedarjs/deploys/6a04215bebfb890008b510e5
😎 Deploy Preview https://deploy-preview-1762--cedarjs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions github-actions Bot added this to the next-release milestone May 12, 2026
@nx-cloud
Copy link
Copy Markdown

nx-cloud Bot commented May 12, 2026

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit a2b8b99

Command Status Duration Result
nx run-many -t test --minWorkers=1 --maxWorkers=4 ✅ Succeeded 1m 33s View ↗
nx run-many -t test:types ✅ Succeeded 10s View ↗
nx run-many -t build ✅ Succeeded 6s View ↗
nx run-many -t build:pack --exclude create-ceda... ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2026-05-13 07:54:08 UTC

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 12, 2026

Greptile Summary

This PR adds a cedar setup neon command that provisions a new Neon Postgres database, migrates SQLite→PostgreSQL, updates db.ts and prisma.config for the Neon driver adapter, writes the connection URLs to .env, and runs the first Prisma migration — all in a single Listr workflow.

  • neonHandler.ts: Full task pipeline with proper skip guards (unsupportedProvider, skipWithNote, databaseUrl presence), pooler-string validation, regex matching both quote styles in prisma.config, and explicit DIRECT_DATABASE_URL injection for the migration subprocess.
  • setup.ts: Registers the new subcommand in the parent setup builder.
  • docs/…/cedarjs-project-overview.md: Adds neon to the CLI tree and converts a few arrows to <- in the scaffold section (api lines only; web lines still use ).

Confidence Score: 5/5

Safe to merge — all the significant correctness issues from earlier review rounds are addressed in this revision.

The task pipeline correctly guards every skip branch, validates the pooler connection string before deriving the direct URL, uses a dual-quote regex to patch prisma.config, protects against unsupported providers, and passes DIRECT_DATABASE_URL explicitly to the migration subprocess. No logic gaps that would produce wrong state or silent failures were found.

No files require special attention; the two suggestions are minor naming and formatting nits.

Important Files Changed

Filename Overview
packages/cli/src/commands/setup/neon/neonHandler.ts Core handler for Neon setup: provisions a Neon database, migrates SQLite to Postgres, updates db.ts/prisma.config/.env. All previously-flagged bugs are addressed. Minor: hasDirectDatabaseUrl is a misleading name for a variable that tracks DATABASE_URL=.
packages/cli/src/commands/setup/neon/neon.ts Yargs command definition for setup neon; exposes --force flag and lazily imports the handler. Clean, no issues.
packages/cli/src/commands/setup.ts Registers the new setupNeon subcommand in the top-level setup builder. Minimal, correct change.
packages/cli/src/commands/setup/neon/templates/db.ts.template Template for the Neon-flavoured db.ts; wires PrismaPg adapter with DATABASE_URL, includes startup guard, and re-exports generated Prisma types. No issues found.
docs/implementation-docs/2026-03-26-cedarjs-project-overview.md Adds neon to the CLI tree. The `

Reviews (9): Last reviewed commit: "Docs update and code formatting" | Re-trigger Greptile

Comment thread packages/cli/src/commands/setup/neonHandler.ts Outdated
Comment thread packages/cli/src/commands/setup/neon/neonHandler.ts
Comment thread packages/cli/src/commands/setup/neon/neonHandler.ts
Comment thread packages/cli/src/commands/setup/neon/neonHandler.ts
Comment thread packages/cli/src/commands/setup/neonHandler.ts Outdated
Comment thread packages/cli/src/commands/setup/neon/neonHandler.ts
Comment thread packages/cli/src/commands/setup/neon/neonHandler.ts
Comment thread packages/cli/src/commands/setup/neon/neonHandler.ts Outdated
- Add equality check after deriving DIRECT_DATABASE_URL from pooler URL
- Change adapter/config skip conditions to check for PrismaPg presence
- Guard addWorkspacePackages against unsupported providers

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Comment thread packages/cli/src/commands/setup/neon/neonHandler.ts
Tobbe and others added 2 commits May 13, 2026 08:45
…y configured

When DATABASE_URL exists without --force, provisioning is skipped so
DIRECT_DATABASE_URL is never written. Updating prisma.config to reference
DIRECT_DATABASE_URL in this state breaks subsequent migrations.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
@Tobbe Tobbe merged commit e7b680a into main May 13, 2026
71 of 75 checks passed
@Tobbe Tobbe deleted the tobbe-feat-cli-setup-neon branch May 13, 2026 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant