create-prisma 0.4.2-next.37.98.1 → 0.4.2-next.55.211.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 (88) hide show
  1. package/README.md +42 -134
  2. package/dist/cli.mjs +5 -2
  3. package/dist/create-DYaOdVnM.mjs +1418 -0
  4. package/dist/index.d.mts +16 -26
  5. package/dist/index.mjs +14 -5
  6. package/package.json +5 -5
  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 +3 -4
  19. package/templates/create/astro/package.json.hbs +1 -1
  20. package/templates/create/astro/src/pages/api/users.ts.hbs +1 -2
  21. package/templates/create/astro/src/pages/index.astro.hbs +6 -6
  22. package/templates/create/astro/tsconfig.json +3 -0
  23. package/templates/create/elysia/package.json.hbs +3 -3
  24. package/templates/create/elysia/src/index.ts.hbs +4 -17
  25. package/templates/create/elysia/tsconfig.json +2 -1
  26. package/templates/create/hono/package.json.hbs +3 -3
  27. package/templates/create/hono/src/index.ts.hbs +2 -5
  28. package/templates/create/hono/tsconfig.json +2 -1
  29. package/templates/create/minimal/package.json.hbs +3 -1
  30. package/templates/create/minimal/src/index.ts.hbs +15 -38
  31. package/templates/create/minimal/tsconfig.json +3 -2
  32. package/templates/create/nest/package.json.hbs +2 -2
  33. package/templates/create/nest/src/app.module.ts.hbs +4 -4
  34. package/templates/create/nest/src/main.ts.hbs +2 -9
  35. package/templates/create/nest/src/prisma.service.ts.hbs +1 -1
  36. package/templates/create/nest/src/users.controller.ts.hbs +3 -4
  37. package/templates/create/nest/src/users.service.ts.hbs +3 -4
  38. package/templates/create/nest/tsconfig.json +2 -1
  39. package/templates/create/next/eslint.config.mjs +8 -1
  40. package/templates/create/next/next.config.ts +1 -1
  41. package/templates/create/next/package.json.hbs +1 -1
  42. package/templates/create/next/src/app/page.tsx.hbs +6 -9
  43. package/templates/create/next/tsconfig.json +1 -0
  44. package/templates/create/nuxt/app/pages/index.vue.hbs +5 -4
  45. package/templates/create/nuxt/nuxt.config.ts +0 -5
  46. package/templates/create/nuxt/package.json.hbs +2 -1
  47. package/templates/create/nuxt/server/api/users.get.ts.hbs +1 -2
  48. package/templates/create/nuxt/tsconfig.json +3 -0
  49. package/templates/create/svelte/package.json.hbs +2 -3
  50. package/templates/create/svelte/src/routes/+page.server.ts.hbs +1 -2
  51. package/templates/create/svelte/src/routes/+page.svelte.hbs +5 -6
  52. package/templates/create/svelte/svelte.config.js +1 -4
  53. package/templates/create/svelte/tsconfig.json +2 -1
  54. package/templates/create/svelte/vite.config.ts +4 -2
  55. package/templates/create/tanstack-start/package.json.hbs +3 -3
  56. package/templates/create/tanstack-start/src/routes/__root.tsx.hbs +2 -2
  57. package/templates/create/tanstack-start/src/routes/index.tsx.hbs +6 -6
  58. package/templates/create/tanstack-start/tsconfig.json +2 -2
  59. package/templates/create/tanstack-start/vite.config.ts +2 -2
  60. package/dist/create-C5pPk2G0.mjs +0 -1853
  61. package/templates/create/_shared/prisma/seed.ts.hbs +0 -53
  62. package/templates/create/astro/README.md.hbs +0 -45
  63. package/templates/create/astro/deno.json.hbs +0 -5
  64. package/templates/create/astro/src/lib/prisma.ts.hbs +0 -71
  65. package/templates/create/elysia/README.md.hbs +0 -42
  66. package/templates/create/elysia/deno.json.hbs +0 -5
  67. package/templates/create/elysia/src/lib/prisma.ts.hbs +0 -71
  68. package/templates/create/hono/README.md.hbs +0 -42
  69. package/templates/create/hono/deno.json.hbs +0 -5
  70. package/templates/create/hono/src/lib/prisma.ts.hbs +0 -71
  71. package/templates/create/minimal/README.md.hbs +0 -39
  72. package/templates/create/minimal/deno.json.hbs +0 -5
  73. package/templates/create/minimal/src/lib/prisma.ts.hbs +0 -71
  74. package/templates/create/nest/README.md.hbs +0 -43
  75. package/templates/create/nest/deno.json.hbs +0 -5
  76. package/templates/create/nest/src/lib/prisma.ts.hbs +0 -71
  77. package/templates/create/next/README.md.hbs +0 -42
  78. package/templates/create/next/deno.json.hbs +0 -12
  79. package/templates/create/next/src/lib/prisma.ts.hbs +0 -71
  80. package/templates/create/nuxt/README.md.hbs +0 -45
  81. package/templates/create/nuxt/deno.json.hbs +0 -5
  82. package/templates/create/nuxt/server/utils/prisma.ts.hbs +0 -71
  83. package/templates/create/svelte/README.md.hbs +0 -44
  84. package/templates/create/svelte/deno.json.hbs +0 -5
  85. package/templates/create/svelte/src/lib/server/prisma.ts.hbs +0 -71
  86. package/templates/create/tanstack-start/README.md.hbs +0 -44
  87. package/templates/create/tanstack-start/deno.json.hbs +0 -12
  88. package/templates/create/tanstack-start/src/lib/prisma.server.ts.hbs +0 -71
package/README.md CHANGED
@@ -1,163 +1,71 @@
1
1
  # create-prisma
2
2
 
3
- Scaffold a new app with Prisma Next already wired up.
3
+ Create a Prisma 8 app with Prisma Composer built in.
4
4
 
5
- `create-prisma@next` gives you a project template, Prisma Next 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 Next dependencies for PostgreSQL or MongoDB
11
- - runs `prisma-next init --no-install` to scaffold `prisma/contract.*`, `prisma-next.config.ts`, `prisma/db.ts`, `prisma-next.md`, and `.env.example`
12
- - writes a template-specific Prisma Next runtime helper
13
- - adds `contract:emit`, `db:init`, `db:update`, `db:verify`, `db:seed`, `migration:plan`, `migrate`, `migration:status`, and `migration:show` scripts
14
- - adds `db:up` / `db:down` and `docker-compose.yml` for default MongoDB projects
15
- - creates or updates `.env` with `DATABASE_URL`
16
- - can install dependencies and run `prisma-next contract emit`
17
-
18
- `db:init`, migrations, and seeding are never run automatically. PostgreSQL projects show
19
- `db:init` as a manual follow-up command; MongoDB projects show `db:up` plus the migration
20
- plan/apply path for initial schema setup.
21
-
22
- ## Quick Start
23
-
24
- Use the package runner you already have:
25
-
26
- ```bash
27
- npx create-prisma@next
28
- ```
29
-
30
- ```bash
31
- pnpm dlx create-prisma@next
32
- ```
33
-
34
- ```bash
35
- yarn dlx create-prisma@next
36
- ```
37
-
38
- ```bash
39
- bunx create-prisma@next
40
- ```
41
-
42
- ```bash
43
- deno run -A npm:create-prisma@next
44
- ```
45
-
46
- If you already have it available locally:
47
-
48
- ```bash
49
- create-prisma
50
- ```
51
-
52
- ## Common Examples
53
-
54
- Create a project interactively:
7
+ Use your package manager:
55
8
 
56
9
  ```bash
57
- 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
58
14
  ```
59
15
 
60
- Create a Minimal project non-interactively:
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.
61
17
 
62
- ```bash
63
- create-prisma --name my-script --template minimal --provider postgres
64
- ```
18
+ The deployment prompt is:
65
19
 
66
- Create a Hono app non-interactively:
67
-
68
- ```bash
69
- create-prisma --name my-api --template hono --provider postgres
20
+ ```text
21
+ Deploy to Prisma now?
70
22
  ```
71
23
 
72
- Create a MongoDB app:
24
+ Choose no to deploy later with the generated `deploy` script.
73
25
 
74
- ```bash
75
- create-prisma --name my-api --template hono --provider mongodb
76
- ```
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.
77
29
 
78
- Scaffold into the current directory:
30
+ ## Templates
79
31
 
80
- ```bash
81
- create-prisma --name . --template hono --provider postgres
82
- ```
83
-
84
- Use TypeScript contract authoring:
32
+ - `minimal`
33
+ - `hono`
34
+ - `elysia`
35
+ - `nest`
36
+ - `next`
37
+ - `svelte` (SvelteKit)
38
+ - `astro`
39
+ - `nuxt`
40
+ - `tanstack-start`
85
41
 
86
- ```bash
87
- create-prisma --name my-app --template next --authoring typescript
88
- ```
42
+ PostgreSQL and MongoDB are supported with PSL or TypeScript contract authoring. npm, pnpm, Yarn, and Bun are supported.
89
43
 
90
- Use Prisma Postgres auto-provisioning:
44
+ ## Options
91
45
 
92
- ```bash
93
- create-prisma --name my-app --template nest --provider postgres --prisma-postgres
94
- ```
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`
95
56
 
96
- ## Supported Templates
57
+ This branch intentionally targets Prisma 8 only. It does not generate a Prisma 7 compatibility path.
97
58
 
98
- - `minimal` - script-first Prisma Next starter with no web framework
99
- - `hono` - lightweight TypeScript API server
100
- - `elysia` - Bun-friendly TypeScript API server
101
- - `nest` - structured Node API with controllers and services
102
- - `next` - full-stack React app with App Router
103
- - `svelte` - full-stack Svelte 5 app with Vite
104
- - `astro` - content-oriented web app with server routes
105
- - `nuxt` - full-stack Vue app with Nitro server routes
106
- - `tanstack-start` - React app with file routes and server functions
107
-
108
- ## Supported Databases
109
-
110
- - `postgres` / `postgresql`
111
- - `mongo` / `mongodb`
112
-
113
- ## Supported Package Managers
114
-
115
- - `npm`
116
- - `pnpm`
117
- - `yarn`
118
- - `bun`
119
- - `deno`
120
-
121
- ## Useful Flags
122
-
123
- - `--name` project name or relative path
124
- - `--template` choose the template
125
- - `--provider postgres|postgresql|mongo|mongodb` (default: `postgres`)
126
- - `--authoring psl|typescript` (default: `psl`)
127
- - `--package-manager` choose the package manager/runtime
128
- - `--database-url` set `DATABASE_URL`
129
- - `--yes` accept defaults and skip prompts
130
- - `--no-install` scaffold only
131
- - `--no-emit` skip `prisma-next contract emit`
132
- - `--prisma-postgres` provision Prisma Postgres for PostgreSQL
133
- - `--force` allow scaffolding into a non-empty directory
134
- - `--verbose` print full command output
135
-
136
- Generated Node-based Prisma Next projects document Node.js 24 LTS or newer.
137
-
138
- ## Local Development
59
+ ## Development
139
60
 
140
61
  ```bash
141
62
  bun install
63
+ bun run test:unit
64
+ bun run typecheck
142
65
  bun run check
143
66
  bun run build
144
- bun run start
145
67
  ```
146
68
 
147
- Useful repo scripts:
148
-
149
- - `bun run dev`
150
- - `bun run typecheck`
151
- - `bun run format`
152
- - `bun run lint`
153
- - `bun run bump`
154
-
155
69
  ## Telemetry
156
70
 
157
- Published builds may send anonymous usage telemetry to help improve the CLI. It does not include project names, file paths, or database URLs.
158
-
159
- Disable it with any of:
160
-
161
- - `DO_NOT_TRACK`
162
- - `CREATE_PRISMA_DISABLE_TELEMETRY`
163
- - `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,9 +1,12 @@
1
1
  #!/usr/bin/env node
2
- import "./create-C5pPk2G0.mjs";
2
+ import "./create-DYaOdVnM.mjs";
3
3
  import { createCreatePrismaCli } from "./index.mjs";
4
4
 
5
5
  //#region src/cli.ts
6
- 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
+ } } });
7
10
 
8
11
  //#endregion
9
12
  export { };