create-prisma 0.3.2 → 0.4.0-pr.32.60.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. package/README.md +86 -117
  2. package/dist/cli.mjs +1 -1
  3. package/dist/{create-DOr8R2_6.mjs → create-Dm_HiTCj.mjs} +221 -120
  4. package/dist/index.d.mts +6 -0
  5. package/dist/index.mjs +2 -2
  6. package/package.json +1 -1
  7. package/templates/create/astro/src/pages/index.astro.hbs +39 -49
  8. package/templates/create/elysia/README.md.hbs +32 -0
  9. package/templates/create/elysia/deno.json.hbs +5 -0
  10. package/templates/create/elysia/package.json.hbs +21 -0
  11. package/templates/create/elysia/prisma/schema.prisma.hbs +25 -0
  12. package/templates/create/elysia/prisma/seed.ts.hbs +42 -0
  13. package/templates/create/elysia/prisma.config.ts.hbs +15 -0
  14. package/templates/create/elysia/src/index.ts.hbs +43 -0
  15. package/templates/create/elysia/src/lib/prisma.ts.hbs +56 -0
  16. package/templates/create/elysia/tsconfig.json +14 -0
  17. package/templates/create/hono/README.md.hbs +3 -2
  18. package/templates/create/hono/package.json.hbs +3 -4
  19. package/templates/create/hono/prisma/schema.prisma.hbs +4 -0
  20. package/templates/create/hono/prisma/seed.ts.hbs +5 -1
  21. package/templates/create/hono/prisma.config.ts.hbs +15 -0
  22. package/templates/create/hono/src/index.ts.hbs +8 -2
  23. package/templates/create/hono/src/lib/prisma.ts.hbs +6 -3
  24. package/templates/create/nest/.yarnrc.yml.hbs +3 -0
  25. package/templates/create/nest/README.md.hbs +32 -0
  26. package/templates/create/nest/deno.json.hbs +5 -0
  27. package/templates/create/nest/package.json.hbs +24 -0
  28. package/templates/create/nest/prisma/schema.prisma.hbs +25 -0
  29. package/templates/create/nest/prisma/seed.ts.hbs +44 -0
  30. package/templates/create/nest/prisma.config.ts.hbs +15 -0
  31. package/templates/create/nest/src/app.controller.ts.hbs +11 -0
  32. package/templates/create/nest/src/app.module.ts.hbs +20 -0
  33. package/templates/create/nest/src/lib/prisma.ts.hbs +58 -0
  34. package/templates/create/nest/src/main.ts.hbs +27 -0
  35. package/templates/create/nest/src/prisma.service.ts.hbs +10 -0
  36. package/templates/create/nest/src/users.controller.ts.hbs +15 -0
  37. package/templates/create/nest/src/users.service.ts.hbs +19 -0
  38. package/templates/create/nest/tsconfig.json +16 -0
  39. package/templates/create/next/src/app/globals.css +38 -46
  40. package/templates/create/nuxt/app/pages/index.vue.hbs +45 -55
  41. package/templates/create/svelte/src/routes/+page.svelte.hbs +78 -99
  42. package/templates/create/tanstack-start/prisma/schema.prisma.hbs +0 -1
  43. package/templates/create/tanstack-start/src/routes/index.tsx.hbs +28 -30
  44. package/templates/create/tanstack-start/src/styles.css +80 -121
  45. package/templates/create/turborepo/apps/api/package.json.hbs +0 -2
  46. package/templates/create/turborepo/apps/api/src/index.ts.hbs +7 -1
  47. package/templates/create/hono/prisma.config.ts +0 -13
package/README.md CHANGED
@@ -1,122 +1,135 @@
1
1
  # create-prisma
2
2
 
3
- A modern Prisma 7 CLI with first-party project templates and a smooth create flow.
3
+ Scaffold a new app with Prisma already wired up.
4
4
 
5
- ## Stack
5
+ `create-prisma` gives you a project template, Prisma setup, database scripts, and a working starting point without making you assemble everything by hand.
6
6
 
7
- - `trpc-cli` for command routing
8
- - `zod@4` for validated input schemas
9
- - `@clack/prompts@1` for interactive UX
10
- - `execa` for external command execution
11
- - `fs-extra` for filesystem operations
12
- - `handlebars` for conditional template rendering
13
- - `tsdown` for ESM builds
7
+ ## What It Does
14
8
 
15
- ## Usage
9
+ - creates a new app from a supported template
10
+ - adds Prisma 7 dependencies for your database
11
+ - scaffolds `prisma/schema.prisma`, `prisma/seed.ts`, and `prisma.config.ts`
12
+ - writes a Prisma client singleton in the right place for the selected template
13
+ - adds `db:generate`, `db:migrate`, and `db:seed` scripts
14
+ - creates or updates `.env` with `DATABASE_URL`
15
+ - can install dependencies and run `prisma generate` for you
16
16
 
17
- Run directly with Bun:
17
+ ## Quick Start
18
18
 
19
- ```bash
20
- bunx create-prisma@latest
21
- ```
22
-
23
- Run directly with Yarn:
19
+ Use the package runner you already have:
24
20
 
25
21
  ```bash
26
- yarn dlx create-prisma@latest
22
+ npx create-prisma@latest
27
23
  ```
28
24
 
29
- Run directly with Deno:
30
-
31
25
  ```bash
32
- deno run -A npm:create-prisma@latest
26
+ pnpm dlx create-prisma@latest
33
27
  ```
34
28
 
35
- Create a new project (default command):
36
-
37
29
  ```bash
38
- create-prisma
30
+ yarn dlx create-prisma@latest
39
31
  ```
40
32
 
41
- Create a Hono project non-interactively:
42
-
43
33
  ```bash
44
- create-prisma --name my-api --template hono --provider postgresql
34
+ bunx create-prisma@latest
45
35
  ```
46
36
 
47
- Create a Next.js project non-interactively:
48
-
49
37
  ```bash
50
- create-prisma --name my-web --template next --provider postgresql
38
+ deno run -A npm:create-prisma@latest
51
39
  ```
52
40
 
53
- Create a SvelteKit project non-interactively:
41
+ If you already have it available locally:
54
42
 
55
43
  ```bash
56
- create-prisma --name my-app --template svelte --provider postgresql
44
+ create-prisma
57
45
  ```
58
46
 
59
- Create an Astro project non-interactively:
47
+ ## Common Examples
48
+
49
+ Create a project interactively:
60
50
 
61
51
  ```bash
62
- create-prisma --name my-site --template astro --provider postgresql
52
+ create-prisma
63
53
  ```
64
54
 
65
- Create a Nuxt project non-interactively:
55
+ Create a Hono app non-interactively:
66
56
 
67
57
  ```bash
68
- create-prisma --name my-nuxt-app --template nuxt --provider postgresql
58
+ create-prisma --name my-api --template hono --provider postgresql
69
59
  ```
70
60
 
71
- Create a TanStack Start project non-interactively:
61
+ Scaffold into the current directory:
72
62
 
73
63
  ```bash
74
- create-prisma --name my-start-app --template tanstack-start --provider postgresql
64
+ create-prisma --name . --template hono --provider postgresql
75
65
  ```
76
66
 
77
- Create a Turborepo project with a `packages/db` Prisma package:
67
+ Create a monorepo with a shared Prisma package:
78
68
 
79
69
  ```bash
80
70
  create-prisma --name my-monorepo --template turborepo --provider postgresql
81
71
  ```
82
72
 
83
- Set package manager non-interactively:
73
+ Use Prisma Postgres auto-provisioning:
84
74
 
85
75
  ```bash
86
- create-prisma --name my-app --template hono --package-manager pnpm --install
76
+ create-prisma --name my-app --template nest --provider postgresql --prisma-postgres
87
77
  ```
88
78
 
89
- Skip Prisma Client generation:
79
+ ## Supported Templates
90
80
 
91
- ```bash
92
- create-prisma --name my-app --template hono --no-generate
93
- ```
81
+ - `hono`
82
+ - `elysia`
83
+ - `nest`
84
+ - `next`
85
+ - `svelte`
86
+ - `astro`
87
+ - `nuxt`
88
+ - `tanstack-start`
89
+ - `turborepo`
94
90
 
95
- Show verbose command output:
91
+ ## Supported Databases
96
92
 
97
- ```bash
98
- create-prisma --name my-app --template hono --verbose
99
- ```
93
+ - `postgresql`
94
+ - `mysql`
95
+ - `sqlite`
96
+ - `sqlserver`
97
+ - `cockroachdb`
100
98
 
101
- Run fully non-interactive with defaults:
99
+ ## Supported Package Managers
102
100
 
103
- ```bash
104
- create-prisma --yes
105
- ```
101
+ - `npm`
102
+ - `pnpm`
103
+ - `yarn`
104
+ - `bun`
105
+ - `deno`
106
106
 
107
- Use Prisma Postgres auto-provisioning for PostgreSQL:
107
+ ## Useful Flags
108
108
 
109
- ```bash
110
- create-prisma --name my-app --template hono --provider postgresql --prisma-postgres
111
- ```
109
+ - `--name` project name or relative path
110
+ - `--template` choose the template
111
+ - `--provider` choose the database provider
112
+ - `--package-manager` choose the package manager/runtime
113
+ - `--schema-preset empty|basic`
114
+ - `--yes` accept defaults and skip prompts
115
+ - `--no-install` scaffold only
116
+ - `--no-generate` skip `prisma generate`
117
+ - `--prisma-postgres` provision Prisma Postgres for PostgreSQL
118
+ - `--skills --mcp --extension` enable optional add-ons
119
+ - `--force` allow scaffolding into a non-empty directory
120
+ - `--verbose` print full command output
112
121
 
113
- Enable add-ons with individual flags:
122
+ ## Add-ons
114
123
 
115
- ```bash
116
- create-prisma --name my-app --template next --skills --mcp --extension
117
- ```
124
+ `create-prisma` can also help with a few optional extras:
125
+
126
+ - Prisma skills for coding agents
127
+ - Prisma MCP setup
128
+ - Prisma IDE extension install
118
129
 
119
- Or run locally:
130
+ These can be selected interactively or enabled with flags.
131
+
132
+ ## Local Development
120
133
 
121
134
  ```bash
122
135
  bun install
@@ -125,64 +138,20 @@ bun run build
125
138
  bun run start
126
139
  ```
127
140
 
128
- The CLI updates `package.json` with Prisma dependencies, optionally runs dependency installation with your selected package manager, and scaffolds Prisma 7 setup files directly inside each app template:
129
-
130
- - `prisma/schema.prisma`
131
- - `prisma/seed.ts`
132
- - `src/lib/prisma.ts`, `src/lib/prisma.server.ts`, `src/lib/server/prisma.ts`, `server/utils/prisma.ts`, or `packages/db/src/client.ts`
133
- - `prisma.config.ts`
134
- - `src/generated/prisma` or `server/generated/prisma` (Nuxt) or `packages/db/src/generated/prisma` (Turborepo)
135
- - `.env` (creates or updates `DATABASE_URL`, and writes `CLAIM_URL` when Prisma Postgres is provisioned)
136
- - runs `prisma generate` automatically after scaffolding
137
-
138
- `create` is the default command and currently supports:
139
-
140
- - templates: `hono`, `next`, `svelte`, `astro`, `nuxt`, `tanstack-start`, `turborepo`
141
- - project name via `--name`
142
- - schema presets via `--schema-preset empty|basic` (default: `basic`)
143
-
144
- `create` prompts for database choice, package manager, and whether to install dependencies now.
145
- Supported providers in this flow: `postgresql`, `mysql`, `sqlite`, `sqlserver`, `cockroachdb`.
146
- Supported package managers: `bun`, `deno`, `npm`, `pnpm`, `yarn`.
147
- Package manager prompt auto-detects from `package.json`/lockfiles/user agent and uses that as the initial selection.
148
- `--yes` accepts defaults (`postgresql`, detected package manager, Prisma Postgres enabled for PostgreSQL, install enabled) and skips prompts.
149
- `--no-generate` skips automatic `prisma generate`.
150
- `--verbose` prints full install/generate command output; default mode keeps output concise.
151
- `--force` (create only) allows scaffolding in a non-empty target directory.
152
- Add-ons can be selected interactively or through flags: `--skills`, `--mcp`, `--extension`.
153
- When add-ons are enabled, `create` prompts for the relevant agent and IDE selections, then installs curated Prisma skills (`skills@latest`), configures Prisma MCP (`add-mcp@latest`), and installs the Prisma IDE extension for supported IDE CLIs.
154
- When `postgresql` is selected, `create` can provision Prisma Postgres via `create-db --json` and auto-fill `DATABASE_URL`.
155
- Generated projects also include `db:seed` and configure Prisma's `migrations.seed` hook to run `tsx prisma/seed.ts`.
141
+ Useful repo scripts:
156
142
 
157
- ## Telemetry
143
+ - `bun run dev`
144
+ - `bun run typecheck`
145
+ - `bun run format`
146
+ - `bun run lint`
147
+ - `bun run bump`
158
148
 
159
- Published builds may send anonymous PostHog telemetry for `create` runs to help improve the CLI. It does not include project names, file paths, or database URLs. Disable it with `DO_NOT_TRACK`, `CREATE_PRISMA_DISABLE_TELEMETRY`, or `CREATE_PRISMA_TELEMETRY_DISABLED`.
160
-
161
- ## Scripts
162
-
163
- - `bun run build` - Build to `dist/`
164
- - `bun run check` - Run formatting and lint checks
165
- - `bun run dev` - Watch mode build
166
- - `bun run start` - Run built CLI
167
- - `bun run lint` - Run `oxlint` with warnings treated as failures
168
- - `bun run lint:fix` - Apply safe `oxlint` fixes
169
- - `bun run format` - Format the repo with `oxfmt`
170
- - `bun run format:check` - Check formatting with `oxfmt`
171
- - `bun run typecheck` - TypeScript checks only
172
- - `bun run bump` - Create a release PR (interactive semver bump)
173
- - `bun run bump -- patch|minor|major|x.y.z` - Non-interactive bump
174
- - `bun run bump -- --dry-run patch` - Preview next version without changing files
175
- - `bun run release-notes` - Generate GitHub release notes via `changelogithub`
176
-
177
- ## Release Workflow
149
+ ## Telemetry
178
150
 
179
- This repo uses a manual, script-driven release flow:
151
+ Published builds may send anonymous usage telemetry to help improve the CLI. It does not include project names, file paths, or database URLs.
180
152
 
181
- 1. Run `bun run bump` (or pass `patch|minor|major|x.y.z`).
182
- 2. The script creates a `release/vX.Y.Z` branch and a PR with commit `chore(release): X.Y.Z`.
183
- 3. Merge that PR to `main` with squash (keep commit title `chore(release): X.Y.Z`).
184
- 4. GitHub Actions runs `bun run check`, `bun run typecheck`, and `bun run build` before publishing.
185
- 5. GitHub Actions creates the `vX.Y.Z` tag and GitHub Release notes via `changelogithub`.
186
- 6. GitHub Actions publishes only for `chore(release):` commits, using npm trusted publishing (OIDC, no npm token secret).
153
+ Disable it with any of:
187
154
 
188
- Every PR from a branch in this repository also publishes a preview package to npm using the dist-tag `pr<PR_NUMBER>`, so PR 3 is installable as `create-prisma@pr3`.
155
+ - `DO_NOT_TRACK`
156
+ - `CREATE_PRISMA_DISABLE_TELEMETRY`
157
+ - `CREATE_PRISMA_TELEMETRY_DISABLED`
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import "./create-DOr8R2_6.mjs";
2
+ import "./create-Dm_HiTCj.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts