create-prisma 0.7.2 → 0.8.0-pr.57.218.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 (131) hide show
  1. package/README.md +39 -155
  2. package/dist/cli.mjs +9 -3
  3. package/dist/create-BHt4J1kk.mjs +1489 -0
  4. package/dist/index.d.mts +43 -59
  5. package/dist/index.mjs +35 -2
  6. package/package.json +24 -19
  7. package/templates/create/_shared/.gitattributes.hbs +11 -0
  8. package/templates/create/_shared/README.md.hbs +72 -0
  9. package/templates/create/_shared/module.ts.hbs +30 -0
  10. package/templates/create/_shared/pnpm-workspace.yaml.hbs +16 -0
  11. package/templates/create/_shared/prisma-composer.config.ts.hbs +13 -0
  12. package/templates/create/_shared/prisma.config.ts.hbs +19 -0
  13. package/templates/create/_shared/service.ts.hbs +44 -0
  14. package/templates/create/_shared/src/prisma/composer.ts.hbs +10 -0
  15. package/templates/create/_shared/src/prisma/db.ts.hbs +63 -0
  16. package/templates/create/_shared/src/prisma/seed.ts.hbs +36 -0
  17. package/templates/create/_shared/src/prisma/users.ts.hbs +35 -0
  18. package/templates/create/astro/{astro.config.mjs.hbs → astro.config.mjs} +1 -2
  19. package/templates/create/astro/package.json.hbs +5 -5
  20. package/templates/create/astro/src/pages/api/users.ts.hbs +6 -23
  21. package/templates/create/astro/src/pages/index.astro.hbs +19 -56
  22. package/templates/create/astro/tsconfig.json +3 -0
  23. package/templates/create/elysia/package.json.hbs +6 -7
  24. package/templates/create/elysia/src/index.ts.hbs +18 -27
  25. package/templates/create/elysia/tsconfig.json +3 -1
  26. package/templates/create/hono/package.json.hbs +6 -7
  27. package/templates/create/hono/src/index.ts.hbs +11 -15
  28. package/templates/create/hono/tsconfig.json +3 -1
  29. package/templates/create/minimal/.yarnrc.yml.hbs +3 -0
  30. package/templates/create/minimal/package.json.hbs +21 -0
  31. package/templates/create/minimal/src/index.ts.hbs +19 -0
  32. package/templates/create/{turborepo/apps/api → minimal}/tsconfig.json +2 -2
  33. package/templates/create/nest/package.json.hbs +7 -7
  34. package/templates/create/nest/src/app.module.ts.hbs +9 -10
  35. package/templates/create/nest/src/main.ts.hbs +3 -10
  36. package/templates/create/nest/src/prisma.service.ts.hbs +6 -5
  37. package/templates/create/nest/src/users.controller.ts.hbs +3 -5
  38. package/templates/create/nest/src/users.service.ts.hbs +4 -11
  39. package/templates/create/nest/tsconfig.json +3 -2
  40. package/templates/create/next/eslint.config.mjs +8 -1
  41. package/templates/create/next/package.json.hbs +10 -10
  42. package/templates/create/next/src/app/page.tsx.hbs +17 -56
  43. package/templates/create/next/tsconfig.json +1 -0
  44. package/templates/create/nuxt/app/pages/index.vue.hbs +12 -45
  45. package/templates/create/nuxt/package.json.hbs +8 -7
  46. package/templates/create/nuxt/server/api/users.get.ts.hbs +3 -15
  47. package/templates/create/nuxt/tsconfig.json +3 -0
  48. package/templates/create/svelte/package.json.hbs +9 -11
  49. package/templates/create/svelte/src/routes/+page.server.ts.hbs +4 -16
  50. package/templates/create/svelte/src/routes/+page.svelte.hbs +14 -164
  51. package/templates/create/svelte/svelte.config.js +1 -4
  52. package/templates/create/svelte/tsconfig.json +2 -1
  53. package/templates/create/svelte/vite.config.ts +3 -0
  54. package/templates/create/tanstack-start/package.json.hbs +14 -14
  55. package/templates/create/tanstack-start/src/routes/__root.tsx.hbs +2 -3
  56. package/templates/create/tanstack-start/src/routes/index.tsx.hbs +27 -78
  57. package/templates/create/tanstack-start/tsconfig.json +4 -2
  58. package/templates/create/tanstack-start/vite.config.ts +2 -4
  59. package/dist/src-B3hRLZ0U.mjs +0 -2527
  60. package/templates/create/astro/README.md.hbs +0 -47
  61. package/templates/create/astro/prisma/schema.prisma.hbs +0 -21
  62. package/templates/create/astro/prisma/seed.ts.hbs +0 -38
  63. package/templates/create/astro/prisma.compute.ts.hbs +0 -10
  64. package/templates/create/astro/prisma.config.ts.hbs +0 -15
  65. package/templates/create/astro/src/lib/prisma.ts.hbs +0 -55
  66. package/templates/create/elysia/README.md.hbs +0 -43
  67. package/templates/create/elysia/deno.json.hbs +0 -5
  68. package/templates/create/elysia/prisma/schema.prisma.hbs +0 -25
  69. package/templates/create/elysia/prisma/seed.ts.hbs +0 -38
  70. package/templates/create/elysia/prisma.compute.ts.hbs +0 -11
  71. package/templates/create/elysia/prisma.config.ts.hbs +0 -15
  72. package/templates/create/elysia/src/lib/prisma.ts.hbs +0 -56
  73. package/templates/create/hono/README.md.hbs +0 -43
  74. package/templates/create/hono/deno.json.hbs +0 -5
  75. package/templates/create/hono/prisma/schema.prisma.hbs +0 -25
  76. package/templates/create/hono/prisma/seed.ts.hbs +0 -38
  77. package/templates/create/hono/prisma.compute.ts.hbs +0 -10
  78. package/templates/create/hono/prisma.config.ts.hbs +0 -15
  79. package/templates/create/hono/src/lib/prisma.ts.hbs +0 -56
  80. package/templates/create/nest/README.md.hbs +0 -43
  81. package/templates/create/nest/deno.json.hbs +0 -5
  82. package/templates/create/nest/prisma/schema.prisma.hbs +0 -25
  83. package/templates/create/nest/prisma/seed.ts.hbs +0 -40
  84. package/templates/create/nest/prisma.compute.ts.hbs +0 -10
  85. package/templates/create/nest/prisma.config.ts.hbs +0 -15
  86. package/templates/create/nest/src/lib/prisma.ts.hbs +0 -58
  87. package/templates/create/next/README.md.hbs +0 -42
  88. package/templates/create/next/deno.json.hbs +0 -12
  89. package/templates/create/next/prisma/schema.prisma.hbs +0 -21
  90. package/templates/create/next/prisma/seed.ts.hbs +0 -38
  91. package/templates/create/next/prisma.compute.ts.hbs +0 -9
  92. package/templates/create/next/prisma.config.ts.hbs +0 -15
  93. package/templates/create/next/src/lib/prisma.ts.hbs +0 -56
  94. package/templates/create/nuxt/README.md.hbs +0 -44
  95. package/templates/create/nuxt/deno.json.hbs +0 -5
  96. package/templates/create/nuxt/prisma/schema.prisma.hbs +0 -21
  97. package/templates/create/nuxt/prisma/seed.ts.hbs +0 -38
  98. package/templates/create/nuxt/prisma.compute.ts.hbs +0 -9
  99. package/templates/create/nuxt/prisma.config.ts.hbs +0 -15
  100. package/templates/create/nuxt/server/utils/prisma.ts.hbs +0 -56
  101. package/templates/create/svelte/README.md.hbs +0 -45
  102. package/templates/create/svelte/deno.json.hbs +0 -5
  103. package/templates/create/svelte/prisma/schema.prisma.hbs +0 -21
  104. package/templates/create/svelte/prisma/seed.ts.hbs +0 -38
  105. package/templates/create/svelte/prisma.config.ts.hbs +0 -15
  106. package/templates/create/svelte/src/lib/server/prisma.ts.hbs +0 -53
  107. package/templates/create/tanstack-start/README.md.hbs +0 -43
  108. package/templates/create/tanstack-start/deno.json.hbs +0 -13
  109. package/templates/create/tanstack-start/prisma/schema.prisma.hbs +0 -21
  110. package/templates/create/tanstack-start/prisma/seed.ts.hbs +0 -38
  111. package/templates/create/tanstack-start/prisma.compute.ts.hbs +0 -9
  112. package/templates/create/tanstack-start/prisma.config.ts.hbs +0 -15
  113. package/templates/create/tanstack-start/src/lib/prisma.server.ts.hbs +0 -56
  114. package/templates/create/turborepo/README.md.hbs +0 -42
  115. package/templates/create/turborepo/apps/api/package.json.hbs +0 -26
  116. package/templates/create/turborepo/apps/api/src/index.ts.hbs +0 -55
  117. package/templates/create/turborepo/deno.json.hbs +0 -5
  118. package/templates/create/turborepo/package.json.hbs +0 -30
  119. package/templates/create/turborepo/packages/db/package.json.hbs +0 -22
  120. package/templates/create/turborepo/packages/db/prisma/schema.prisma.hbs +0 -21
  121. package/templates/create/turborepo/packages/db/prisma/seed.ts.hbs +0 -38
  122. package/templates/create/turborepo/packages/db/prisma.config.ts.hbs +0 -15
  123. package/templates/create/turborepo/packages/db/src/client.ts.hbs +0 -63
  124. package/templates/create/turborepo/packages/db/src/index.ts +0 -2
  125. package/templates/create/turborepo/packages/db/tsconfig.json +0 -15
  126. package/templates/create/turborepo/pnpm-workspace.yaml +0 -3
  127. package/templates/create/turborepo/prisma.compute.ts.hbs +0 -14
  128. package/templates/create/turborepo/turbo.json +0 -28
  129. /package/templates/create/{astro → _shared}/deno.json.hbs +0 -0
  130. /package/templates/create/{turborepo → elysia}/.yarnrc.yml.hbs +0 -0
  131. /package/templates/create/next/{next.config.ts.hbs → next.config.ts} +0 -0
package/README.md CHANGED
@@ -1,195 +1,79 @@
1
1
  # create-prisma
2
2
 
3
- Scaffold a new app with Prisma already wired up.
3
+ Create a Prisma 8 app with Prisma Composer built in.
4
4
 
5
- `create-prisma` gives you a project template, Prisma setup, database scripts, and a working starting point without making you assemble everything by hand.
5
+ ## Quick start
6
6
 
7
- ## What It Does
8
-
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`, `prisma.config.ts`, and Compute deploy defaults for Compute-ready templates
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 the template env file with `DATABASE_URL`
15
- - can install dependencies and run `prisma generate` for you
16
- - can deploy the finished app to Prisma Compute and return a live URL
17
-
18
- ## Quick Start
19
-
20
- Use the package runner you already have:
21
-
22
- ```bash
23
- npx create-prisma@latest
24
- ```
25
-
26
- ```bash
27
- pnpm dlx create-prisma@latest
28
- ```
29
-
30
- ```bash
31
- yarn dlx create-prisma@latest
32
- ```
33
-
34
- ```bash
35
- bunx create-prisma@latest
36
- ```
37
-
38
- ```bash
39
- deno run -A npm:create-prisma@latest
40
- ```
41
-
42
- If you already have it available locally:
43
-
44
- ```bash
45
- create-prisma
46
- ```
47
-
48
- ## Common Examples
49
-
50
- Create a project interactively:
51
-
52
- ```bash
53
- create-prisma
54
- ```
55
-
56
- Create a Hono app non-interactively:
57
-
58
- ```bash
59
- create-prisma --name my-api --template hono --provider postgresql
60
- ```
61
-
62
- Scaffold into the current directory:
7
+ Use your package manager:
63
8
 
64
9
  ```bash
65
- create-prisma --name . --template hono --provider postgresql
10
+ npx create-prisma@latest my-app
11
+ pnpm dlx create-prisma@latest my-app
12
+ yarn dlx create-prisma@latest my-app
13
+ bunx create-prisma@latest my-app
66
14
  ```
67
15
 
68
- Create a monorepo with a shared Prisma package:
16
+ The CLI initializes Prisma 8 with `prisma@next`, installs dependencies, emits the contract, and generates a deployable Composer app. PostgreSQL projects use Composer's native Prisma Postgres provider, including migrations and a typed runtime client.
69
17
 
70
- ```bash
71
- create-prisma --name my-monorepo --template turborepo --provider postgresql
72
- ```
73
-
74
- Use Prisma Postgres auto-provisioning:
75
-
76
- ```bash
77
- create-prisma --name my-app --template nest --provider postgresql --prisma-postgres
78
- ```
18
+ The deployment prompt is:
79
19
 
80
- Deploy a supported app to Prisma Compute:
81
-
82
- ```bash
83
- create-prisma --name my-api --template hono --provider postgresql --deploy
20
+ ```text
21
+ Deploy to Prisma now?
84
22
  ```
85
23
 
86
- With PostgreSQL and no `--database-url`, the Compute flow asks whether to use Prisma Postgres. If accepted, or if `--prisma-postgres` is passed, it creates a Prisma Compute project, creates a `main` Prisma Postgres database on the `main` branch, writes `DATABASE_URL` to the template env file, and deploys the app with the env file configured in `prisma.compute.ts`. Pass `--no-prisma-postgres` to deploy without provisioning a database.
24
+ Choose no to deploy later with the generated `deploy` script.
87
25
 
88
- ## Supported Templates
89
-
90
- - `hono`
91
- - `elysia`
92
- - `nest`
93
- - `next`
94
- - `svelte`
95
- - `astro`
96
- - `nuxt`
97
- - `tanstack-start`
98
- - `turborepo`
26
+ When multiple Prisma workspace sessions are available, the CLI asks which workspace should receive
27
+ the deployment. For unattended usage, pass `--workspace <id-or-name>` or omit it to use the active
28
+ workspace. Choosing another workspace also updates the Prisma CLI's active workspace session.
99
29
 
100
- Prisma Compute deployment is currently supported for:
30
+ ## Templates
101
31
 
32
+ - `minimal`
102
33
  - `hono`
103
34
  - `elysia`
104
35
  - `nest`
105
36
  - `next`
37
+ - `svelte` (SvelteKit)
106
38
  - `astro`
107
39
  - `nuxt`
108
40
  - `tanstack-start`
109
- - `turborepo`
110
41
 
111
- ## Supported Databases
42
+ PostgreSQL and MongoDB are supported with PSL or TypeScript contract authoring. npm, pnpm, Yarn, and Bun are supported.
112
43
 
113
- - `postgresql`
114
- - `mysql`
115
- - `sqlite`
116
- - `sqlserver`
117
- - `cockroachdb`
118
-
119
- ## Supported Package Managers
120
-
121
- - `npm`
122
- - `pnpm`
123
- - `yarn`
124
- - `bun`
125
- - `deno`
126
-
127
- ## Useful Flags
128
-
129
- - `--name` project name or relative path
130
- - `--template` choose the template
131
- - `--provider` choose the database provider
132
- - `--package-manager` choose the package manager/runtime
133
- - `--schema-preset empty|basic`
134
- - `--deploy` deploy supported templates to Prisma Compute
135
- - `--yes` accept defaults and skip prompts
136
- - `--no-install` scaffold only
137
- - `--no-generate` skip `prisma generate`
138
- - `--prisma-postgres` provision Prisma Postgres for PostgreSQL
139
- - `--skills --mcp --extension` enable optional add-ons
140
- - `--force` allow scaffolding into a non-empty directory
141
- - `--verbose` print full command output
142
-
143
- ## Add-ons
144
-
145
- `create-prisma` can also help with a few optional extras:
146
-
147
- - Prisma skills for coding agents
148
- - Prisma MCP setup
149
- - Prisma IDE extension install
150
-
151
- These can be selected interactively or enabled with flags.
152
- When Prisma Compute deploy is selected, the skills add-on recommends the `prisma-compute` skill too.
153
-
154
- ## Deploy to Prisma Compute
155
-
156
- After scaffolding, `create-prisma` can deploy your app to [Prisma Compute](https://www.prisma.io/docs/compute), the serverless hosting for TypeScript apps that runs next to your Prisma Postgres database. It is offered for the templates the Prisma CLI can deploy today: `hono`, `elysia`, `nest`, `next`, `astro`, `nuxt`, `tanstack-start`, and `turborepo`.
157
-
158
- Accept the deploy prompt when it appears, or pass the flag:
44
+ Deno is supported for local minimal PostgreSQL apps:
159
45
 
160
46
  ```bash
161
- create-prisma --name my-api --template hono --provider postgresql --deploy
47
+ deno run -A npm:create-prisma@latest my-deno-app --template minimal --provider postgres --package-manager deno --no-deploy
162
48
  ```
163
49
 
164
- The deploy step signs you in with the Prisma CLI if you are not signed in yet. With PostgreSQL and no `--database-url`, create-prisma asks whether to use Prisma Postgres. If accepted, or if `--prisma-postgres` is passed, setup creates a Prisma Compute project, creates a `main` Prisma Postgres database on the `main` branch, writes `DATABASE_URL` to the template env file, runs the requested Prisma setup, then deploys the app with the env file configured in `prisma.compute.ts`. Pass `--no-prisma-postgres` to deploy without provisioning a database.
50
+ Prisma Compute does not support Deno deployments yet.
51
+
52
+ ## Options
165
53
 
166
- A `prisma.compute.ts` file is generated with the app framework, runtime port, target, and env-file defaults. When deployment is selected, a `compute:deploy` script is added to the generated project so you can redeploy app changes later. That script runs `@prisma/cli@latest app deploy` using `prisma.compute.ts`; it does not create a new project, create a new database, run migrations, or seed data.
54
+ - positional project name or `--name`
55
+ - `--template`
56
+ - `--provider postgres|postgresql|mongo|mongodb`
57
+ - `--authoring psl|typescript`
58
+ - `--package-manager npm|pnpm|yarn|bun|deno`
59
+ - `--deploy` / `--no-deploy`
60
+ - `--workspace <id-or-name>`
61
+ - `--yes`
62
+ - `--force`
63
+ - `--verbose`
167
64
 
168
- The deploy prompt is skipped in `--yes` runs unless you pass `--deploy`. Browser sign-in may still need a person at the keyboard if no Prisma CLI session exists.
65
+ This branch intentionally targets Prisma 8 only. It does not generate a Prisma 7 compatibility path.
169
66
 
170
- ## Local Development
67
+ ## Development
171
68
 
172
69
  ```bash
173
70
  bun install
71
+ bun run test:unit
72
+ bun run typecheck
174
73
  bun run check
175
74
  bun run build
176
- bun run start
177
75
  ```
178
76
 
179
- Useful repo scripts:
180
-
181
- - `bun run dev`
182
- - `bun run typecheck`
183
- - `bun run format`
184
- - `bun run lint`
185
- - `bun run bump`
186
-
187
77
  ## Telemetry
188
78
 
189
- Published builds may send anonymous usage telemetry to help improve the CLI. It does not include project names, file paths, or database URLs.
190
-
191
- Disable it with any of:
192
-
193
- - `DO_NOT_TRACK`
194
- - `CREATE_PRISMA_DISABLE_TELEMETRY`
195
- - `CREATE_PRISMA_TELEMETRY_DISABLED`
79
+ Published builds may send anonymous usage telemetry. It never includes project names, file paths, or database URLs. Disable it with `DO_NOT_TRACK`, `CREATE_PRISMA_DISABLE_TELEMETRY`, or `CREATE_PRISMA_TELEMETRY_DISABLED`.
package/dist/cli.mjs CHANGED
@@ -1,6 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import { n as createCreatePrismaCli } from "./src-B3hRLZ0U.mjs";
2
+ import "./create-BHt4J1kk.mjs";
3
+ import { createCreatePrismaCli } from "./index.mjs";
4
+
3
5
  //#region src/cli.ts
4
- createCreatePrismaCli().run();
6
+ createCreatePrismaCli().run({ process: { exit(code) {
7
+ const commandExitCode = typeof process.exitCode === "number" && process.exitCode !== 0 ? process.exitCode : code;
8
+ process.exit(commandExitCode);
9
+ } } });
10
+
5
11
  //#endregion
6
- export {};
12
+ export { };