create-prisma 0.7.2 → 0.8.0-pr.56.216.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 +35 -159
  2. package/dist/cli.mjs +9 -3
  3. package/dist/create-BeMLn0T7.mjs +1409 -0
  4. package/dist/index.d.mts +43 -62
  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 +39 -0
  9. package/templates/create/_shared/module.ts.hbs +28 -0
  10. package/templates/create/_shared/pnpm-workspace.yaml.hbs +16 -0
  11. package/templates/create/_shared/prisma-composer.config.ts.hbs +11 -0
  12. package/templates/create/_shared/prisma.config.ts.hbs +17 -0
  13. package/templates/create/_shared/service.ts.hbs +42 -0
  14. package/templates/create/_shared/src/prisma/composer.ts.hbs +8 -0
  15. package/templates/create/_shared/src/prisma/db.ts.hbs +51 -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 +15 -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/deno.json.hbs +0 -5
  62. package/templates/create/astro/prisma/schema.prisma.hbs +0 -21
  63. package/templates/create/astro/prisma/seed.ts.hbs +0 -38
  64. package/templates/create/astro/prisma.compute.ts.hbs +0 -10
  65. package/templates/create/astro/prisma.config.ts.hbs +0 -15
  66. package/templates/create/astro/src/lib/prisma.ts.hbs +0 -55
  67. package/templates/create/elysia/README.md.hbs +0 -43
  68. package/templates/create/elysia/deno.json.hbs +0 -5
  69. package/templates/create/elysia/prisma/schema.prisma.hbs +0 -25
  70. package/templates/create/elysia/prisma/seed.ts.hbs +0 -38
  71. package/templates/create/elysia/prisma.compute.ts.hbs +0 -11
  72. package/templates/create/elysia/prisma.config.ts.hbs +0 -15
  73. package/templates/create/elysia/src/lib/prisma.ts.hbs +0 -56
  74. package/templates/create/hono/README.md.hbs +0 -43
  75. package/templates/create/hono/deno.json.hbs +0 -5
  76. package/templates/create/hono/prisma/schema.prisma.hbs +0 -25
  77. package/templates/create/hono/prisma/seed.ts.hbs +0 -38
  78. package/templates/create/hono/prisma.compute.ts.hbs +0 -10
  79. package/templates/create/hono/prisma.config.ts.hbs +0 -15
  80. package/templates/create/hono/src/lib/prisma.ts.hbs +0 -56
  81. package/templates/create/nest/README.md.hbs +0 -43
  82. package/templates/create/nest/deno.json.hbs +0 -5
  83. package/templates/create/nest/prisma/schema.prisma.hbs +0 -25
  84. package/templates/create/nest/prisma/seed.ts.hbs +0 -40
  85. package/templates/create/nest/prisma.compute.ts.hbs +0 -10
  86. package/templates/create/nest/prisma.config.ts.hbs +0 -15
  87. package/templates/create/nest/src/lib/prisma.ts.hbs +0 -58
  88. package/templates/create/next/README.md.hbs +0 -42
  89. package/templates/create/next/deno.json.hbs +0 -12
  90. package/templates/create/next/prisma/schema.prisma.hbs +0 -21
  91. package/templates/create/next/prisma/seed.ts.hbs +0 -38
  92. package/templates/create/next/prisma.compute.ts.hbs +0 -9
  93. package/templates/create/next/prisma.config.ts.hbs +0 -15
  94. package/templates/create/next/src/lib/prisma.ts.hbs +0 -56
  95. package/templates/create/nuxt/README.md.hbs +0 -44
  96. package/templates/create/nuxt/deno.json.hbs +0 -5
  97. package/templates/create/nuxt/prisma/schema.prisma.hbs +0 -21
  98. package/templates/create/nuxt/prisma/seed.ts.hbs +0 -38
  99. package/templates/create/nuxt/prisma.compute.ts.hbs +0 -9
  100. package/templates/create/nuxt/prisma.config.ts.hbs +0 -15
  101. package/templates/create/nuxt/server/utils/prisma.ts.hbs +0 -56
  102. package/templates/create/svelte/README.md.hbs +0 -45
  103. package/templates/create/svelte/deno.json.hbs +0 -5
  104. package/templates/create/svelte/prisma/schema.prisma.hbs +0 -21
  105. package/templates/create/svelte/prisma/seed.ts.hbs +0 -38
  106. package/templates/create/svelte/prisma.config.ts.hbs +0 -15
  107. package/templates/create/svelte/src/lib/server/prisma.ts.hbs +0 -53
  108. package/templates/create/tanstack-start/README.md.hbs +0 -43
  109. package/templates/create/tanstack-start/deno.json.hbs +0 -13
  110. package/templates/create/tanstack-start/prisma/schema.prisma.hbs +0 -21
  111. package/templates/create/tanstack-start/prisma/seed.ts.hbs +0 -38
  112. package/templates/create/tanstack-start/prisma.compute.ts.hbs +0 -9
  113. package/templates/create/tanstack-start/prisma.config.ts.hbs +0 -15
  114. package/templates/create/tanstack-start/src/lib/prisma.server.ts.hbs +0 -56
  115. package/templates/create/turborepo/README.md.hbs +0 -42
  116. package/templates/create/turborepo/apps/api/package.json.hbs +0 -26
  117. package/templates/create/turborepo/apps/api/src/index.ts.hbs +0 -55
  118. package/templates/create/turborepo/deno.json.hbs +0 -5
  119. package/templates/create/turborepo/package.json.hbs +0 -30
  120. package/templates/create/turborepo/packages/db/package.json.hbs +0 -22
  121. package/templates/create/turborepo/packages/db/prisma/schema.prisma.hbs +0 -21
  122. package/templates/create/turborepo/packages/db/prisma/seed.ts.hbs +0 -38
  123. package/templates/create/turborepo/packages/db/prisma.config.ts.hbs +0 -15
  124. package/templates/create/turborepo/packages/db/src/client.ts.hbs +0 -63
  125. package/templates/create/turborepo/packages/db/src/index.ts +0 -2
  126. package/templates/create/turborepo/packages/db/tsconfig.json +0 -15
  127. package/templates/create/turborepo/pnpm-workspace.yaml +0 -3
  128. package/templates/create/turborepo/prisma.compute.ts.hbs +0 -14
  129. package/templates/create/turborepo/turbo.json +0 -28
  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,71 @@
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:
7
+ Use your package manager:
43
8
 
44
9
  ```bash
45
- create-prisma
10
+ npx create-prisma@next my-app
11
+ pnpm dlx create-prisma@next my-app
12
+ yarn dlx create-prisma@next my-app
13
+ bunx create-prisma@next my-app
46
14
  ```
47
15
 
48
- ## Common Examples
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.
49
17
 
50
- Create a project interactively:
18
+ The deployment prompt is:
51
19
 
52
- ```bash
53
- create-prisma
20
+ ```text
21
+ Deploy to Prisma now?
54
22
  ```
55
23
 
56
- Create a Hono app non-interactively:
24
+ Choose no to deploy later with the generated `deploy` script.
57
25
 
58
- ```bash
59
- create-prisma --name my-api --template hono --provider postgresql
60
- ```
61
-
62
- Scaffold into the current directory:
63
-
64
- ```bash
65
- create-prisma --name . --template hono --provider postgresql
66
- ```
67
-
68
- Create a monorepo with a shared Prisma package:
69
-
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
- ```
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.
79
29
 
80
- Deploy a supported app to Prisma Compute:
81
-
82
- ```bash
83
- create-prisma --name my-api --template hono --provider postgresql --deploy
84
- ```
85
-
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.
87
-
88
- ## Supported Templates
30
+ ## Templates
89
31
 
32
+ - `minimal`
90
33
  - `hono`
91
34
  - `elysia`
92
35
  - `nest`
93
36
  - `next`
94
- - `svelte`
37
+ - `svelte` (SvelteKit)
95
38
  - `astro`
96
39
  - `nuxt`
97
40
  - `tanstack-start`
98
- - `turborepo`
99
-
100
- Prisma Compute deployment is currently supported for:
101
-
102
- - `hono`
103
- - `elysia`
104
- - `nest`
105
- - `next`
106
- - `astro`
107
- - `nuxt`
108
- - `tanstack-start`
109
- - `turborepo`
110
-
111
- ## Supported Databases
112
-
113
- - `postgresql`
114
- - `mysql`
115
- - `sqlite`
116
- - `sqlserver`
117
- - `cockroachdb`
118
-
119
- ## Supported Package Managers
120
41
 
121
- - `npm`
122
- - `pnpm`
123
- - `yarn`
124
- - `bun`
125
- - `deno`
42
+ PostgreSQL and MongoDB are supported with PSL or TypeScript contract authoring. npm, pnpm, Yarn, and Bun are supported.
126
43
 
127
- ## Useful Flags
44
+ ## Options
128
45
 
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
46
+ - positional project name or `--name`
47
+ - `--template`
48
+ - `--provider postgres|postgresql|mongo|mongodb`
49
+ - `--authoring psl|typescript`
50
+ - `--package-manager npm|pnpm|yarn|bun`
51
+ - `--deploy` / `--no-deploy`
52
+ - `--workspace <id-or-name>`
53
+ - `--yes`
54
+ - `--force`
55
+ - `--verbose`
142
56
 
143
- ## Add-ons
57
+ This branch intentionally targets Prisma 8 only. It does not generate a Prisma 7 compatibility path.
144
58
 
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:
159
-
160
- ```bash
161
- create-prisma --name my-api --template hono --provider postgresql --deploy
162
- ```
163
-
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.
165
-
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.
167
-
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.
169
-
170
- ## Local Development
59
+ ## Development
171
60
 
172
61
  ```bash
173
62
  bun install
63
+ bun run test:unit
64
+ bun run typecheck
174
65
  bun run check
175
66
  bun run build
176
- bun run start
177
67
  ```
178
68
 
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
69
  ## Telemetry
188
70
 
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`
71
+ 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-BeMLn0T7.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 { };