Skip to content

Commit f3ab42f

Browse files
TobbeCommandCodeBot
andcommitted
feat(cli): setup neon (#1762)
Add setup command for using a new Neon Postgres database --------- Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
1 parent 6c1c386 commit f3ab42f

5 files changed

Lines changed: 545 additions & 5 deletions

File tree

docs/implementation-docs/2026-03-26-cedarjs-project-overview.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ cedar
175175
│ └── render│serverless │ └── secret│package│model
176176
├── destroy (d) [mirror] ├── setup
177177
├── exec [script] │ ├── auth <provider>
178-
├── experimental │ ├── vite│docker│i18n│jobs
178+
├── experimental │ ├── vite│docker│i18n│jobs|neon
179179
│ ├── rsc│streaming-ssr │ ├── deploy│ui│cache│realtime
180180
│ ├── live-queries │ └── mailer│middleware│server-file
181181
│ └── opentelemetry │
@@ -188,10 +188,10 @@ cedar new → yarn create cedar-app (standalone)
188188
## SCAFFOLD OUTPUT (`cedar generate scaffold Post`)
189189

190190
```
191-
api/src/graphql/posts.sdl.ts schema only (types, queries, mutations, inputs)
192-
api/src/services/posts/posts.ts resolver implementations (typed against auto-generated types/graphql)
193-
api/src/services/posts/posts.test.ts tests
194-
api/src/services/posts/posts.scenarios.ts test fixtures
191+
api/src/graphql/posts.sdl.ts <- schema only (types, queries, mutations, inputs)
192+
api/src/services/posts/posts.ts <- resolver implementations (typed against auto-generated types/graphql)
193+
api/src/services/posts/posts.test.ts <- tests
194+
api/src/services/posts/posts.scenarios.ts <- test fixtures
195195
196196
web/src/components/Post/
197197
PostForm.tsx ← form (uses @cedarjs/forms typed fields)

packages/cli/src/commands/setup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import * as setupJobs from './setup/jobs/jobs.js'
2222
import * as setupMailer from './setup/mailer/mailer.js'
2323
import * as setupMiddleware from './setup/middleware/middleware.js'
2424
import * as setupMonitoring from './setup/monitoring/monitoring.js'
25+
import * as setupNeon from './setup/neon/neon.js'
2526
// @ts-expect-error - Types not available for JS files
2627
import * as setupPackage from './setup/package/package.js'
2728
// @ts-expect-error - Types not available for JS files
@@ -55,6 +56,7 @@ export const builder = (yargs: Argv) =>
5556
.command(setupMiddleware)
5657
// @ts-expect-error - Yargs TS types aren't very good
5758
.command(setupMonitoring)
59+
.command(setupNeon)
5860
.command(setupPackage)
5961
.command(setupRealtime)
6062
.command(setupServerFile)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import type { Argv } from 'yargs'
2+
3+
import { recordTelemetryAttributes } from '@cedarjs/cli-helpers'
4+
5+
export const command = 'neon'
6+
export const description =
7+
'Provision a Neon Postgres database and configure your project'
8+
9+
export function builder(yargs: Argv) {
10+
return yargs.option('force', {
11+
alias: 'f',
12+
default: false,
13+
description: 'Overwrite existing DATABASE_URL in .env',
14+
type: 'boolean',
15+
})
16+
}
17+
18+
export interface Args {
19+
force: boolean
20+
}
21+
22+
export async function handler({ force }: Args) {
23+
recordTelemetryAttributes({
24+
command: 'setup neon',
25+
force,
26+
})
27+
28+
const { handler } = await import('./neonHandler.js')
29+
return handler({ force })
30+
}

0 commit comments

Comments
 (0)