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.
- package/README.md +39 -155
- package/dist/cli.mjs +9 -3
- package/dist/create-BHt4J1kk.mjs +1489 -0
- package/dist/index.d.mts +43 -59
- package/dist/index.mjs +35 -2
- package/package.json +24 -19
- package/templates/create/_shared/.gitattributes.hbs +11 -0
- package/templates/create/_shared/README.md.hbs +72 -0
- package/templates/create/_shared/module.ts.hbs +30 -0
- package/templates/create/_shared/pnpm-workspace.yaml.hbs +16 -0
- package/templates/create/_shared/prisma-composer.config.ts.hbs +13 -0
- package/templates/create/_shared/prisma.config.ts.hbs +19 -0
- package/templates/create/_shared/service.ts.hbs +44 -0
- package/templates/create/_shared/src/prisma/composer.ts.hbs +10 -0
- package/templates/create/_shared/src/prisma/db.ts.hbs +63 -0
- package/templates/create/_shared/src/prisma/seed.ts.hbs +36 -0
- package/templates/create/_shared/src/prisma/users.ts.hbs +35 -0
- package/templates/create/astro/{astro.config.mjs.hbs → astro.config.mjs} +1 -2
- package/templates/create/astro/package.json.hbs +5 -5
- package/templates/create/astro/src/pages/api/users.ts.hbs +6 -23
- package/templates/create/astro/src/pages/index.astro.hbs +19 -56
- package/templates/create/astro/tsconfig.json +3 -0
- package/templates/create/elysia/package.json.hbs +6 -7
- package/templates/create/elysia/src/index.ts.hbs +18 -27
- package/templates/create/elysia/tsconfig.json +3 -1
- package/templates/create/hono/package.json.hbs +6 -7
- package/templates/create/hono/src/index.ts.hbs +11 -15
- package/templates/create/hono/tsconfig.json +3 -1
- package/templates/create/minimal/.yarnrc.yml.hbs +3 -0
- package/templates/create/minimal/package.json.hbs +21 -0
- package/templates/create/minimal/src/index.ts.hbs +19 -0
- package/templates/create/{turborepo/apps/api → minimal}/tsconfig.json +2 -2
- package/templates/create/nest/package.json.hbs +7 -7
- package/templates/create/nest/src/app.module.ts.hbs +9 -10
- package/templates/create/nest/src/main.ts.hbs +3 -10
- package/templates/create/nest/src/prisma.service.ts.hbs +6 -5
- package/templates/create/nest/src/users.controller.ts.hbs +3 -5
- package/templates/create/nest/src/users.service.ts.hbs +4 -11
- package/templates/create/nest/tsconfig.json +3 -2
- package/templates/create/next/eslint.config.mjs +8 -1
- package/templates/create/next/package.json.hbs +10 -10
- package/templates/create/next/src/app/page.tsx.hbs +17 -56
- package/templates/create/next/tsconfig.json +1 -0
- package/templates/create/nuxt/app/pages/index.vue.hbs +12 -45
- package/templates/create/nuxt/package.json.hbs +8 -7
- package/templates/create/nuxt/server/api/users.get.ts.hbs +3 -15
- package/templates/create/nuxt/tsconfig.json +3 -0
- package/templates/create/svelte/package.json.hbs +9 -11
- package/templates/create/svelte/src/routes/+page.server.ts.hbs +4 -16
- package/templates/create/svelte/src/routes/+page.svelte.hbs +14 -164
- package/templates/create/svelte/svelte.config.js +1 -4
- package/templates/create/svelte/tsconfig.json +2 -1
- package/templates/create/svelte/vite.config.ts +3 -0
- package/templates/create/tanstack-start/package.json.hbs +14 -14
- package/templates/create/tanstack-start/src/routes/__root.tsx.hbs +2 -3
- package/templates/create/tanstack-start/src/routes/index.tsx.hbs +27 -78
- package/templates/create/tanstack-start/tsconfig.json +4 -2
- package/templates/create/tanstack-start/vite.config.ts +2 -4
- package/dist/src-B3hRLZ0U.mjs +0 -2527
- package/templates/create/astro/README.md.hbs +0 -47
- package/templates/create/astro/prisma/schema.prisma.hbs +0 -21
- package/templates/create/astro/prisma/seed.ts.hbs +0 -38
- package/templates/create/astro/prisma.compute.ts.hbs +0 -10
- package/templates/create/astro/prisma.config.ts.hbs +0 -15
- package/templates/create/astro/src/lib/prisma.ts.hbs +0 -55
- package/templates/create/elysia/README.md.hbs +0 -43
- package/templates/create/elysia/deno.json.hbs +0 -5
- package/templates/create/elysia/prisma/schema.prisma.hbs +0 -25
- package/templates/create/elysia/prisma/seed.ts.hbs +0 -38
- package/templates/create/elysia/prisma.compute.ts.hbs +0 -11
- package/templates/create/elysia/prisma.config.ts.hbs +0 -15
- package/templates/create/elysia/src/lib/prisma.ts.hbs +0 -56
- package/templates/create/hono/README.md.hbs +0 -43
- package/templates/create/hono/deno.json.hbs +0 -5
- package/templates/create/hono/prisma/schema.prisma.hbs +0 -25
- package/templates/create/hono/prisma/seed.ts.hbs +0 -38
- package/templates/create/hono/prisma.compute.ts.hbs +0 -10
- package/templates/create/hono/prisma.config.ts.hbs +0 -15
- package/templates/create/hono/src/lib/prisma.ts.hbs +0 -56
- package/templates/create/nest/README.md.hbs +0 -43
- package/templates/create/nest/deno.json.hbs +0 -5
- package/templates/create/nest/prisma/schema.prisma.hbs +0 -25
- package/templates/create/nest/prisma/seed.ts.hbs +0 -40
- package/templates/create/nest/prisma.compute.ts.hbs +0 -10
- package/templates/create/nest/prisma.config.ts.hbs +0 -15
- package/templates/create/nest/src/lib/prisma.ts.hbs +0 -58
- package/templates/create/next/README.md.hbs +0 -42
- package/templates/create/next/deno.json.hbs +0 -12
- package/templates/create/next/prisma/schema.prisma.hbs +0 -21
- package/templates/create/next/prisma/seed.ts.hbs +0 -38
- package/templates/create/next/prisma.compute.ts.hbs +0 -9
- package/templates/create/next/prisma.config.ts.hbs +0 -15
- package/templates/create/next/src/lib/prisma.ts.hbs +0 -56
- package/templates/create/nuxt/README.md.hbs +0 -44
- package/templates/create/nuxt/deno.json.hbs +0 -5
- package/templates/create/nuxt/prisma/schema.prisma.hbs +0 -21
- package/templates/create/nuxt/prisma/seed.ts.hbs +0 -38
- package/templates/create/nuxt/prisma.compute.ts.hbs +0 -9
- package/templates/create/nuxt/prisma.config.ts.hbs +0 -15
- package/templates/create/nuxt/server/utils/prisma.ts.hbs +0 -56
- package/templates/create/svelte/README.md.hbs +0 -45
- package/templates/create/svelte/deno.json.hbs +0 -5
- package/templates/create/svelte/prisma/schema.prisma.hbs +0 -21
- package/templates/create/svelte/prisma/seed.ts.hbs +0 -38
- package/templates/create/svelte/prisma.config.ts.hbs +0 -15
- package/templates/create/svelte/src/lib/server/prisma.ts.hbs +0 -53
- package/templates/create/tanstack-start/README.md.hbs +0 -43
- package/templates/create/tanstack-start/deno.json.hbs +0 -13
- package/templates/create/tanstack-start/prisma/schema.prisma.hbs +0 -21
- package/templates/create/tanstack-start/prisma/seed.ts.hbs +0 -38
- package/templates/create/tanstack-start/prisma.compute.ts.hbs +0 -9
- package/templates/create/tanstack-start/prisma.config.ts.hbs +0 -15
- package/templates/create/tanstack-start/src/lib/prisma.server.ts.hbs +0 -56
- package/templates/create/turborepo/README.md.hbs +0 -42
- package/templates/create/turborepo/apps/api/package.json.hbs +0 -26
- package/templates/create/turborepo/apps/api/src/index.ts.hbs +0 -55
- package/templates/create/turborepo/deno.json.hbs +0 -5
- package/templates/create/turborepo/package.json.hbs +0 -30
- package/templates/create/turborepo/packages/db/package.json.hbs +0 -22
- package/templates/create/turborepo/packages/db/prisma/schema.prisma.hbs +0 -21
- package/templates/create/turborepo/packages/db/prisma/seed.ts.hbs +0 -38
- package/templates/create/turborepo/packages/db/prisma.config.ts.hbs +0 -15
- package/templates/create/turborepo/packages/db/src/client.ts.hbs +0 -63
- package/templates/create/turborepo/packages/db/src/index.ts +0 -2
- package/templates/create/turborepo/packages/db/tsconfig.json +0 -15
- package/templates/create/turborepo/pnpm-workspace.yaml +0 -3
- package/templates/create/turborepo/prisma.compute.ts.hbs +0 -14
- package/templates/create/turborepo/turbo.json +0 -28
- /package/templates/create/{astro → _shared}/deno.json.hbs +0 -0
- /package/templates/create/{turborepo → elysia}/.yarnrc.yml.hbs +0 -0
- /package/templates/create/next/{next.config.ts.hbs → next.config.ts} +0 -0
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import * as _orpc_server0 from "@orpc/server";
|
|
3
|
+
import * as trpc_cli0 from "trpc-cli";
|
|
2
4
|
import { z } from "zod";
|
|
3
5
|
|
|
4
6
|
//#region node_modules/@orpc/client/dist/index.d.mts
|
|
@@ -173,13 +175,12 @@ type ErrorMap = { [key in ORPCErrorCode]?: ErrorMapItem<AnySchema> };
|
|
|
173
175
|
type MergedErrorMap<T1 extends ErrorMap, T2 extends ErrorMap> = Omit<T1, keyof T2> & T2;
|
|
174
176
|
//#endregion
|
|
175
177
|
//#region src/types.d.ts
|
|
176
|
-
declare const DatabaseProviderSchema: z.ZodEnum<{
|
|
178
|
+
declare const DatabaseProviderSchema: z.ZodPipe<z.ZodEnum<{
|
|
179
|
+
postgres: "postgres";
|
|
177
180
|
postgresql: "postgresql";
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
cockroachdb: "cockroachdb";
|
|
182
|
-
}>;
|
|
181
|
+
mongo: "mongo";
|
|
182
|
+
mongodb: "mongodb";
|
|
183
|
+
}>, z.ZodTransform<"postgres" | "mongo", "postgres" | "postgresql" | "mongo" | "mongodb">>;
|
|
183
184
|
declare const PackageManagerSchema: z.ZodEnum<{
|
|
184
185
|
npm: "npm";
|
|
185
186
|
pnpm: "pnpm";
|
|
@@ -187,11 +188,12 @@ declare const PackageManagerSchema: z.ZodEnum<{
|
|
|
187
188
|
bun: "bun";
|
|
188
189
|
deno: "deno";
|
|
189
190
|
}>;
|
|
190
|
-
declare const
|
|
191
|
-
|
|
192
|
-
|
|
191
|
+
declare const AuthoringStyleSchema: z.ZodEnum<{
|
|
192
|
+
psl: "psl";
|
|
193
|
+
typescript: "typescript";
|
|
193
194
|
}>;
|
|
194
195
|
declare const CreateTemplateSchema: z.ZodEnum<{
|
|
196
|
+
minimal: "minimal";
|
|
195
197
|
hono: "hono";
|
|
196
198
|
elysia: "elysia";
|
|
197
199
|
nest: "nest";
|
|
@@ -200,18 +202,19 @@ declare const CreateTemplateSchema: z.ZodEnum<{
|
|
|
200
202
|
astro: "astro";
|
|
201
203
|
nuxt: "nuxt";
|
|
202
204
|
"tanstack-start": "tanstack-start";
|
|
203
|
-
turborepo: "turborepo";
|
|
204
205
|
}>;
|
|
205
|
-
declare const DatabaseUrlSchema: z.ZodString;
|
|
206
206
|
declare const CreateCommandInputSchema: z.ZodObject<{
|
|
207
207
|
yes: z.ZodOptional<z.ZodBoolean>;
|
|
208
208
|
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
209
|
-
provider: z.ZodOptional<z.ZodEnum<{
|
|
209
|
+
provider: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
210
|
+
postgres: "postgres";
|
|
210
211
|
postgresql: "postgresql";
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
212
|
+
mongo: "mongo";
|
|
213
|
+
mongodb: "mongodb";
|
|
214
|
+
}>, z.ZodTransform<"postgres" | "mongo", "postgres" | "postgresql" | "mongo" | "mongodb">>>;
|
|
215
|
+
authoring: z.ZodOptional<z.ZodEnum<{
|
|
216
|
+
psl: "psl";
|
|
217
|
+
typescript: "typescript";
|
|
215
218
|
}>>;
|
|
216
219
|
packageManager: z.ZodOptional<z.ZodEnum<{
|
|
217
220
|
npm: "npm";
|
|
@@ -220,17 +223,11 @@ declare const CreateCommandInputSchema: z.ZodObject<{
|
|
|
220
223
|
bun: "bun";
|
|
221
224
|
deno: "deno";
|
|
222
225
|
}>>;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
install: z.ZodOptional<z.ZodBoolean>;
|
|
226
|
-
generate: z.ZodOptional<z.ZodBoolean>;
|
|
227
|
-
migrateAndSeed: z.ZodOptional<z.ZodBoolean>;
|
|
228
|
-
schemaPreset: z.ZodOptional<z.ZodEnum<{
|
|
229
|
-
empty: "empty";
|
|
230
|
-
basic: "basic";
|
|
231
|
-
}>>;
|
|
226
|
+
deploy: z.ZodOptional<z.ZodBoolean>;
|
|
227
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
232
228
|
name: z.ZodOptional<z.ZodString>;
|
|
233
229
|
template: z.ZodOptional<z.ZodEnum<{
|
|
230
|
+
minimal: "minimal";
|
|
234
231
|
hono: "hono";
|
|
235
232
|
elysia: "elysia";
|
|
236
233
|
nest: "nest";
|
|
@@ -239,46 +236,38 @@ declare const CreateCommandInputSchema: z.ZodObject<{
|
|
|
239
236
|
astro: "astro";
|
|
240
237
|
nuxt: "nuxt";
|
|
241
238
|
"tanstack-start": "tanstack-start";
|
|
242
|
-
turborepo: "turborepo";
|
|
243
239
|
}>>;
|
|
244
|
-
skills: z.ZodOptional<z.ZodBoolean>;
|
|
245
|
-
mcp: z.ZodOptional<z.ZodBoolean>;
|
|
246
|
-
extension: z.ZodOptional<z.ZodBoolean>;
|
|
247
|
-
deploy: z.ZodOptional<z.ZodBoolean>;
|
|
248
240
|
force: z.ZodOptional<z.ZodBoolean>;
|
|
249
241
|
}, z.core.$strip>;
|
|
250
242
|
type CreateCommandInput = z.infer<typeof CreateCommandInputSchema>;
|
|
251
243
|
//#endregion
|
|
252
244
|
//#region src/index.d.ts
|
|
253
245
|
declare const router: {
|
|
254
|
-
create:
|
|
255
|
-
yes:
|
|
256
|
-
verbose:
|
|
257
|
-
provider:
|
|
246
|
+
create: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>, z.ZodTuple<[z.ZodOptional<z.ZodString>, z.ZodObject<{
|
|
247
|
+
yes: z.ZodOptional<z.ZodBoolean>;
|
|
248
|
+
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
249
|
+
provider: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
250
|
+
postgres: "postgres";
|
|
258
251
|
postgresql: "postgresql";
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
252
|
+
mongo: "mongo";
|
|
253
|
+
mongodb: "mongodb";
|
|
254
|
+
}>, z.ZodTransform<"postgres" | "mongo", "postgres" | "postgresql" | "mongo" | "mongodb">>>;
|
|
255
|
+
authoring: z.ZodOptional<z.ZodEnum<{
|
|
256
|
+
psl: "psl";
|
|
257
|
+
typescript: "typescript";
|
|
263
258
|
}>>;
|
|
264
|
-
packageManager:
|
|
259
|
+
packageManager: z.ZodOptional<z.ZodEnum<{
|
|
265
260
|
npm: "npm";
|
|
266
261
|
pnpm: "pnpm";
|
|
267
262
|
yarn: "yarn";
|
|
268
263
|
bun: "bun";
|
|
269
264
|
deno: "deno";
|
|
270
265
|
}>>;
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
schemaPreset: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
277
|
-
empty: "empty";
|
|
278
|
-
basic: "basic";
|
|
279
|
-
}>>;
|
|
280
|
-
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
281
|
-
template: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
266
|
+
deploy: z.ZodOptional<z.ZodBoolean>;
|
|
267
|
+
workspace: z.ZodOptional<z.ZodString>;
|
|
268
|
+
name: z.ZodOptional<z.ZodString>;
|
|
269
|
+
template: z.ZodOptional<z.ZodEnum<{
|
|
270
|
+
minimal: "minimal";
|
|
282
271
|
hono: "hono";
|
|
283
272
|
elysia: "elysia";
|
|
284
273
|
nest: "nest";
|
|
@@ -287,16 +276,11 @@ declare const router: {
|
|
|
287
276
|
astro: "astro";
|
|
288
277
|
nuxt: "nuxt";
|
|
289
278
|
"tanstack-start": "tanstack-start";
|
|
290
|
-
turborepo: "turborepo";
|
|
291
279
|
}>>;
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
extension: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
295
|
-
deploy: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
296
|
-
force: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
297
|
-
}, import("zod/v4/core").$strip>>, Schema<void, void>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
280
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
281
|
+
}, z.core.$strip>], null>, Schema<void, void>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
298
282
|
};
|
|
299
|
-
declare function createCreatePrismaCli():
|
|
283
|
+
declare function createCreatePrismaCli(): trpc_cli0.TrpcCli;
|
|
300
284
|
declare function create(input?: CreateCommandInput): Promise<void>;
|
|
301
285
|
//#endregion
|
|
302
|
-
export { type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema,
|
|
286
|
+
export { AuthoringStyleSchema, type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, router };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,36 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as
|
|
3
|
-
|
|
2
|
+
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-BHt4J1kk.mjs";
|
|
3
|
+
import { os } from "@orpc/server";
|
|
4
|
+
import { createCli } from "trpc-cli";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
//#region src/index.ts
|
|
8
|
+
const CLI_VERSION = "0.8.0-pr.57.218.1";
|
|
9
|
+
const CreateCliInputSchema = z.tuple([z.string().trim().min(1, "Please enter a valid project name").optional().describe("Project name / directory"), CreateCommandInputSchema]);
|
|
10
|
+
function normalizeCreateCliInput(input) {
|
|
11
|
+
const [projectName, options] = input;
|
|
12
|
+
return {
|
|
13
|
+
...options,
|
|
14
|
+
name: options.name ?? projectName
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const router = os.router({ create: os.meta({
|
|
18
|
+
description: "Create a new project with Prisma setup",
|
|
19
|
+
default: true,
|
|
20
|
+
negateBooleans: true
|
|
21
|
+
}).input(CreateCliInputSchema).handler(async ({ input }) => {
|
|
22
|
+
await runCreateCommand(normalizeCreateCliInput(input));
|
|
23
|
+
}) });
|
|
24
|
+
function createCreatePrismaCli() {
|
|
25
|
+
return createCli({
|
|
26
|
+
router,
|
|
27
|
+
name: "create-prisma",
|
|
28
|
+
version: CLI_VERSION
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async function create(input = {}) {
|
|
32
|
+
await runCreateCommand(input);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
//#endregion
|
|
36
|
+
export { AuthoringStyleSchema, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, PackageManagerSchema, create, createCreatePrismaCli, router };
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-prisma",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-pr.57.218.1",
|
|
4
4
|
"private": false,
|
|
5
|
-
"description": "Create Prisma
|
|
5
|
+
"description": "Create Prisma 8 projects with first-party templates and great DX.",
|
|
6
6
|
"homepage": "https://github.com/prisma/create-prisma",
|
|
7
7
|
"bugs": {
|
|
8
8
|
"url": "https://github.com/prisma/create-prisma/issues"
|
|
@@ -33,9 +33,12 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
-
"build": "tsdown
|
|
37
|
-
"dev": "tsdown --
|
|
36
|
+
"build": "tsdown",
|
|
37
|
+
"dev": "tsdown --watch",
|
|
38
38
|
"start": "bun run ./dist/cli.mjs",
|
|
39
|
+
"test": "bun run test:unit && bun run test:e2e",
|
|
40
|
+
"test:unit": "bun test ./tests/dependencies.test.ts ./tests/deploy-with-composer.test.ts ./tests/install.test.ts ./tests/node-version.test.ts ./tests/setup-prisma.test.ts ./tests/telemetry.test.ts",
|
|
41
|
+
"test:e2e": "bun test --timeout 180000 ./tests/e2e/create-prisma.e2e.test.ts",
|
|
39
42
|
"check": "bun run format:check && bun run lint",
|
|
40
43
|
"lint": "oxlint . --deny-warnings",
|
|
41
44
|
"lint:fix": "oxlint . --fix",
|
|
@@ -47,28 +50,30 @@
|
|
|
47
50
|
"release-notes": "bunx changelogithub"
|
|
48
51
|
},
|
|
49
52
|
"dependencies": {
|
|
50
|
-
"@clack/prompts": "^1.
|
|
51
|
-
"@orpc/server": "^1.
|
|
53
|
+
"@clack/prompts": "^1.7.0",
|
|
54
|
+
"@orpc/server": "^1.13.5",
|
|
52
55
|
"execa": "^9.6.1",
|
|
53
|
-
"fs-extra": "^11.3.
|
|
54
|
-
"handlebars": "^4.7.
|
|
55
|
-
"posthog-node": "^5.
|
|
56
|
-
"trpc-cli": "^0.
|
|
57
|
-
"zod": "^4.
|
|
56
|
+
"fs-extra": "^11.3.3",
|
|
57
|
+
"handlebars": "^4.7.8",
|
|
58
|
+
"posthog-node": "^5.28.2",
|
|
59
|
+
"trpc-cli": "^0.12.4",
|
|
60
|
+
"zod": "^4.3.6"
|
|
58
61
|
},
|
|
59
62
|
"devDependencies": {
|
|
60
|
-
"@
|
|
63
|
+
"@prisma/dev": "0.24.7",
|
|
64
|
+
"@types/bun": "^1.3.9",
|
|
61
65
|
"@types/fs-extra": "^11.0.4",
|
|
62
|
-
"@types/node": "^
|
|
66
|
+
"@types/node": "^25.3.0",
|
|
63
67
|
"changelogithub": "^14.0.0",
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
+
"mongodb-memory-server": "11.1.0",
|
|
69
|
+
"oxfmt": "^0.37.0",
|
|
70
|
+
"oxlint": "^1.52.0",
|
|
71
|
+
"tsdown": "^0.20.3",
|
|
72
|
+
"typescript": "^5.9.3"
|
|
68
73
|
},
|
|
69
74
|
"engines": {
|
|
70
75
|
"bun": ">=1.3.0",
|
|
71
|
-
"node": ">=18.0
|
|
76
|
+
"node": ">=22.18.0"
|
|
72
77
|
},
|
|
73
|
-
"packageManager": "bun@1.3.
|
|
78
|
+
"packageManager": "bun@1.3.9"
|
|
74
79
|
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{{#if (eq authoring "typescript")}}
|
|
2
|
+
src/prisma/generated/contract.json linguist-generated
|
|
3
|
+
src/prisma/generated/contract.d.ts linguist-generated
|
|
4
|
+
{{else}}
|
|
5
|
+
src/prisma/contract.json linguist-generated
|
|
6
|
+
src/prisma/contract.d.ts linguist-generated
|
|
7
|
+
{{/if}}
|
|
8
|
+
src/prisma/ops.json linguist-generated
|
|
9
|
+
src/prisma/migration.json linguist-generated
|
|
10
|
+
migrations/snapshots/**/contract.json linguist-generated
|
|
11
|
+
migrations/snapshots/**/contract.d.ts linguist-generated
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# {{projectName}}
|
|
2
|
+
|
|
3
|
+
{{#if (eq packageManager "deno")}}
|
|
4
|
+
A minimal Prisma 8 app for Deno and PostgreSQL.
|
|
5
|
+
|
|
6
|
+
## Run locally
|
|
7
|
+
|
|
8
|
+
Copy `.env.example` to `.env`, set `DATABASE_URL`, then initialize the database:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
deno task db:init
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Start the app:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
deno task dev
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
The starter users are inserted idempotently from `src/prisma/seed.ts` on the first database query.
|
|
21
|
+
|
|
22
|
+
## Prisma
|
|
23
|
+
|
|
24
|
+
- Contract: `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
25
|
+
- Prisma config: `prisma-next.config.ts`
|
|
26
|
+
|
|
27
|
+
After changing the contract, run:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
deno task contract:emit
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Prisma Compute does not support Deno deployments yet.
|
|
34
|
+
{{else}}
|
|
35
|
+
A minimal {{template}} app with Prisma 8 and Prisma Composer.
|
|
36
|
+
|
|
37
|
+
## Run locally
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
{{runScriptCommand packageManager "dev:composer"}}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
This builds the app and starts it with Composer. PostgreSQL projects get a local Prisma Postgres database and apply the contract automatically.
|
|
44
|
+
|
|
45
|
+
## Deploy
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
{{runScriptCommand packageManager "deploy"}}
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
The deploy script builds the framework output, provisions Prisma Postgres when selected, applies migrations, and deploys the app to Prisma Compute.
|
|
52
|
+
|
|
53
|
+
The starter users are inserted idempotently from `src/prisma/seed.ts` on the first database query through the Composer service binding.
|
|
54
|
+
|
|
55
|
+
{{#if (eq provider "mongo")}}
|
|
56
|
+
MongoDB is not provisioned by Composer. Set `MONGODB_URL` before running Composer locally or deploying.
|
|
57
|
+
{{/if}}
|
|
58
|
+
|
|
59
|
+
## Prisma
|
|
60
|
+
|
|
61
|
+
- Contract: `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
62
|
+
- Prisma and Composer config: `prisma.config.ts`
|
|
63
|
+
- Composer app: `module.ts` and `service.ts`
|
|
64
|
+
|
|
65
|
+
After changing the contract, run:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
{{runScriptCommand packageManager "contract:emit"}}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
To use the framework's development server directly, run `{{runScriptCommand packageManager "dev"}}`. This direct mode requires `DATABASE_URL`.
|
|
72
|
+
{{/if}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{{#unless (eq packageManager "deno")}}
|
|
2
|
+
import { module } from "@prisma/composer";
|
|
3
|
+
{{#if (eq provider "postgres")}}
|
|
4
|
+
import { pnPostgres } from "@prisma/composer-prisma-cloud/prisma-next";
|
|
5
|
+
|
|
6
|
+
import { appContract } from "./src/prisma/composer.ts";
|
|
7
|
+
{{else}}
|
|
8
|
+
import { envSecret } from "@prisma/composer-prisma-cloud";
|
|
9
|
+
{{/if}}
|
|
10
|
+
import app from "./service.ts";
|
|
11
|
+
|
|
12
|
+
export default module("{{projectName}}", ({ provision }) => {
|
|
13
|
+
{{#if (eq provider "postgres")}}
|
|
14
|
+
const database = provision(
|
|
15
|
+
pnPostgres({
|
|
16
|
+
name: "database",
|
|
17
|
+
contract: appContract,
|
|
18
|
+
config: "./prisma.config.ts",
|
|
19
|
+
}),
|
|
20
|
+
{ id: "database" },
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
provision(app, { deps: { database } });
|
|
24
|
+
{{else}}
|
|
25
|
+
provision(app, {
|
|
26
|
+
input: { databaseUrl: envSecret("MONGODB_URL") },
|
|
27
|
+
});
|
|
28
|
+
{{/if}}
|
|
29
|
+
});
|
|
30
|
+
{{/unless}}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{{#if (eq packageManager "pnpm")}}
|
|
2
|
+
allowBuilds:
|
|
3
|
+
esbuild: true
|
|
4
|
+
msgpackr-extract: true
|
|
5
|
+
{{#if (eq template "next")}}
|
|
6
|
+
sharp: true
|
|
7
|
+
unrs-resolver: true
|
|
8
|
+
{{else if (eq template "astro")}}
|
|
9
|
+
sharp: true
|
|
10
|
+
{{/if}}
|
|
11
|
+
workerd: true
|
|
12
|
+
minimumReleaseAgeExclude:
|
|
13
|
+
- "@prisma/*"
|
|
14
|
+
overrides:
|
|
15
|
+
effect: "4.0.0-beta.103"
|
|
16
|
+
{{/if}}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{{#unless (eq packageManager "deno")}}
|
|
2
|
+
import { defineConfig } from "@prisma/composer/config";
|
|
3
|
+
import { nodeBuild } from "@prisma/composer/node/control";
|
|
4
|
+
{{#if (eq template "next")}}
|
|
5
|
+
import { nextjsBuild } from "@prisma/composer/nextjs/control";
|
|
6
|
+
{{/if}}
|
|
7
|
+
import { prismaCloud, prismaState } from "@prisma/composer-prisma-cloud/control";
|
|
8
|
+
|
|
9
|
+
export default defineConfig({
|
|
10
|
+
extensions: [prismaCloud(), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
|
|
11
|
+
state: prismaState(),
|
|
12
|
+
});
|
|
13
|
+
{{/unless}}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{{#unless (eq packageManager "deno")}}
|
|
2
|
+
import { definePrismaConfig } from "@prisma/cli-engine";
|
|
3
|
+
import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
|
|
4
|
+
|
|
5
|
+
export default definePrismaConfig({
|
|
6
|
+
orm: ormConfig({
|
|
7
|
+
contract: "./src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}",
|
|
8
|
+
{{#if (eq authoring "typescript")}}
|
|
9
|
+
output: "./src/prisma/generated",
|
|
10
|
+
{{/if}}
|
|
11
|
+
db: {
|
|
12
|
+
connection: process.env.{{#if (eq provider "postgres")}}DATABASE_URL{{else}}MONGODB_URL{{/if}}!,
|
|
13
|
+
},
|
|
14
|
+
}),
|
|
15
|
+
composer: {
|
|
16
|
+
configPath: "./prisma-composer.config.ts",
|
|
17
|
+
},
|
|
18
|
+
});
|
|
19
|
+
{{/unless}}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{{#unless (eq packageManager "deno")}}
|
|
2
|
+
{{#if (eq template "next")}}
|
|
3
|
+
import nextjs from "@prisma/composer/nextjs";
|
|
4
|
+
{{else}}
|
|
5
|
+
import node from "@prisma/composer/node";
|
|
6
|
+
{{/if}}
|
|
7
|
+
{{#if (eq provider "mongo")}}
|
|
8
|
+
import { secretString } from "@prisma/composer/arktype";
|
|
9
|
+
import { type } from "arktype";
|
|
10
|
+
{{/if}}
|
|
11
|
+
import { compute } from "@prisma/composer-prisma-cloud";
|
|
12
|
+
{{#if (eq provider "postgres")}}
|
|
13
|
+
import { pnPostgres } from "@prisma/composer-prisma-cloud/prisma-next";
|
|
14
|
+
|
|
15
|
+
import { appContract } from "./src/prisma/composer.ts";
|
|
16
|
+
{{/if}}
|
|
17
|
+
|
|
18
|
+
export default compute({
|
|
19
|
+
name: "app",
|
|
20
|
+
deps: {
|
|
21
|
+
{{#if (eq provider "postgres")}}
|
|
22
|
+
database: pnPostgres(appContract),
|
|
23
|
+
{{/if}}
|
|
24
|
+
},
|
|
25
|
+
{{#if (eq provider "mongo")}}
|
|
26
|
+
input: type({
|
|
27
|
+
databaseUrl: secretString(),
|
|
28
|
+
}),
|
|
29
|
+
{{/if}}
|
|
30
|
+
{{#if (eq template "next")}}
|
|
31
|
+
build: nextjs({ module: import.meta.url, appDir: "." }),
|
|
32
|
+
{{else if (eq template "svelte")}}
|
|
33
|
+
build: node({ module: import.meta.url, dir: "./build", entry: "index.js" }),
|
|
34
|
+
{{else if (eq template "astro")}}
|
|
35
|
+
build: node({ module: import.meta.url, dir: "./dist", entry: "server/entry.mjs" }),
|
|
36
|
+
{{else if (eq template "nuxt")}}
|
|
37
|
+
build: node({ module: import.meta.url, dir: "./.output", entry: "server/index.mjs" }),
|
|
38
|
+
{{else if (eq template "tanstack-start")}}
|
|
39
|
+
build: node({ module: import.meta.url, dir: "./.output", entry: "server/index.mjs" }),
|
|
40
|
+
{{else}}
|
|
41
|
+
build: node({ module: import.meta.url, entry: "./dist/server.mjs" }),
|
|
42
|
+
{{/if}}
|
|
43
|
+
});
|
|
44
|
+
{{/unless}}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{{#unless (eq packageManager "deno")}}
|
|
2
|
+
{{#if (eq provider "postgres")}}
|
|
3
|
+
import { pnContract } from "@prisma/composer-prisma-cloud/prisma-next";
|
|
4
|
+
|
|
5
|
+
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
6
|
+
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
7
|
+
|
|
8
|
+
export const appContract = pnContract<Contract>(contractJson);
|
|
9
|
+
{{/if}}
|
|
10
|
+
{{/unless}}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
{{#if (eq provider "postgres")}}
|
|
2
|
+
import postgres from "@prisma/orm-postgres/runtime";
|
|
3
|
+
|
|
4
|
+
{{#if (eq packageManager "deno")}}
|
|
5
|
+
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
6
|
+
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
7
|
+
|
|
8
|
+
const databaseUrl = Deno.env.get("DATABASE_URL");
|
|
9
|
+
if (!databaseUrl) {
|
|
10
|
+
throw new Error("DATABASE_URL is not set. Add it to .env before starting the app.");
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const db = postgres<Contract>({ contractJson, url: databaseUrl });
|
|
14
|
+
{{else}}
|
|
15
|
+
import service from "../../service.ts";
|
|
16
|
+
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
17
|
+
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
18
|
+
|
|
19
|
+
function loadComposerDatabase() {
|
|
20
|
+
try {
|
|
21
|
+
return service.load().database.client;
|
|
22
|
+
} catch {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export const db =
|
|
28
|
+
loadComposerDatabase() ??
|
|
29
|
+
(process.env.DATABASE_URL
|
|
30
|
+
? postgres<Contract>({ contractJson, url: process.env.DATABASE_URL })
|
|
31
|
+
: postgres<Contract>({ contractJson }));
|
|
32
|
+
{{/if}}
|
|
33
|
+
{{else}}
|
|
34
|
+
import mongo from "@prisma/orm-mongo/runtime";
|
|
35
|
+
|
|
36
|
+
import service from "../../service.ts";
|
|
37
|
+
import type { Contract } from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.d.ts";
|
|
38
|
+
import contractJson from "./{{#if (eq authoring "typescript")}}generated/{{/if}}contract.json" with { type: "json" };
|
|
39
|
+
|
|
40
|
+
function getDatabaseUrl(): string | undefined {
|
|
41
|
+
try {
|
|
42
|
+
return service.input().databaseUrl.expose();
|
|
43
|
+
} catch {
|
|
44
|
+
return process.env.DATABASE_URL;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const databaseUrl = getDatabaseUrl();
|
|
49
|
+
|
|
50
|
+
export const db = databaseUrl
|
|
51
|
+
? mongo<Contract>({ contractJson, url: databaseUrl })
|
|
52
|
+
: mongo<Contract>({ contractJson });
|
|
53
|
+
{{/if}}
|
|
54
|
+
|
|
55
|
+
let connection: Promise<void> | undefined;
|
|
56
|
+
|
|
57
|
+
export function connectDatabase(): Promise<void> {
|
|
58
|
+
connection ??= db.connect().then(() => undefined).catch((error: unknown) => {
|
|
59
|
+
connection = undefined;
|
|
60
|
+
throw error;
|
|
61
|
+
});
|
|
62
|
+
return connection;
|
|
63
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { connectDatabase, db } from "./db.ts";
|
|
2
|
+
|
|
3
|
+
const users = [
|
|
4
|
+
{ email: "alice@prisma.io", username: "alice", name: "Alice" },
|
|
5
|
+
{ email: "bob@prisma.io", username: "bob", name: "Bob" },
|
|
6
|
+
{ email: "carol@prisma.io", username: "carol", name: "Carol" },
|
|
7
|
+
];
|
|
8
|
+
|
|
9
|
+
let pendingSeed: Promise<void> | undefined;
|
|
10
|
+
|
|
11
|
+
async function runSeed(): Promise<void> {
|
|
12
|
+
await connectDatabase();
|
|
13
|
+
|
|
14
|
+
{{#if (eq provider "mongo")}}
|
|
15
|
+
for (const user of users) {
|
|
16
|
+
const existingUser = await db.orm.users.where({ email: user.email }).first();
|
|
17
|
+
if (!existingUser) await db.orm.users.create(user);
|
|
18
|
+
}
|
|
19
|
+
{{else}}
|
|
20
|
+
for (const user of users) {
|
|
21
|
+
await db.orm.public.User.upsert({
|
|
22
|
+
create: user,
|
|
23
|
+
update: {},
|
|
24
|
+
conflictOn: { email: user.email },
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
{{/if}}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function seed(): Promise<void> {
|
|
31
|
+
pendingSeed ??= runSeed().catch((error: unknown) => {
|
|
32
|
+
pendingSeed = undefined;
|
|
33
|
+
throw error;
|
|
34
|
+
});
|
|
35
|
+
return pendingSeed;
|
|
36
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { db } from "./db.ts";
|
|
2
|
+
import { seed } from "./seed.ts";
|
|
3
|
+
|
|
4
|
+
export { db };
|
|
5
|
+
|
|
6
|
+
export async function listUsers(limit = 10) {
|
|
7
|
+
await seed();
|
|
8
|
+
{{#if (eq provider "mongo")}}
|
|
9
|
+
const users = [];
|
|
10
|
+
|
|
11
|
+
for await (const user of db.orm.users.select("_id", "email", "username", "name").take(limit).all()) {
|
|
12
|
+
users.push({
|
|
13
|
+
id: String(user._id),
|
|
14
|
+
email: user.email,
|
|
15
|
+
username: user.username ?? null,
|
|
16
|
+
name: user.name ?? null,
|
|
17
|
+
createdAt: null as Date | null,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return users;
|
|
22
|
+
{{else}}
|
|
23
|
+
const users = await db.orm.public.User.select("id", "email", "username", "name", "createdAt").take(limit).all();
|
|
24
|
+
|
|
25
|
+
return users.map((user) => ({
|
|
26
|
+
id: String(user.id),
|
|
27
|
+
email: user.email,
|
|
28
|
+
username: user.username ?? null,
|
|
29
|
+
name: user.name ?? null,
|
|
30
|
+
createdAt: user.createdAt,
|
|
31
|
+
}));
|
|
32
|
+
{{/if}}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
// @ts-check
|
|
2
|
-
import { defineConfig } from "astro/config";
|
|
3
2
|
import node from "@astrojs/node";
|
|
3
|
+
import { defineConfig } from "astro/config";
|
|
4
4
|
|
|
5
5
|
// https://astro.build/config
|
|
6
6
|
export default defineConfig({
|
|
7
7
|
output: "server",
|
|
8
8
|
adapter: node({ mode: "standalone" }),
|
|
9
|
-
server: { host: true },
|
|
10
9
|
});
|