create-prisma 0.4.2-next.37.105.1 → 0.4.2-next.37.108.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 +14 -14
- package/dist/cli.mjs +1 -1
- package/dist/{create-BIV2KC9D.mjs → create-C7SXN6bn.mjs} +9 -14
- package/dist/index.d.mts +16 -18
- package/dist/index.mjs +13 -4
- package/package.json +1 -1
- package/templates/create/_shared/{prisma → src/prisma}/seed.ts.hbs +1 -13
- package/templates/create/{hono/src/lib/prisma.ts.hbs → _shared/src/prisma/users.ts.hbs} +3 -20
- package/templates/create/astro/README.md.hbs +4 -3
- package/templates/create/astro/src/pages/api/users.ts.hbs +1 -2
- package/templates/create/astro/src/pages/index.astro.hbs +2 -2
- package/templates/create/elysia/README.md.hbs +4 -3
- package/templates/create/elysia/src/index.ts.hbs +1 -1
- package/templates/create/hono/README.md.hbs +4 -3
- package/templates/create/hono/src/index.ts.hbs +1 -1
- package/templates/create/minimal/README.md.hbs +4 -3
- package/templates/create/minimal/src/index.ts.hbs +1 -1
- package/templates/create/minimal/tsconfig.json +1 -1
- package/templates/create/nest/README.md.hbs +4 -3
- package/templates/create/nest/src/prisma.service.ts.hbs +1 -1
- package/templates/create/next/README.md.hbs +4 -3
- package/templates/create/next/src/app/page.tsx.hbs +2 -2
- package/templates/create/nuxt/README.md.hbs +4 -3
- package/templates/create/nuxt/app/pages/index.vue.hbs +1 -1
- package/templates/create/nuxt/server/api/users.get.ts.hbs +1 -2
- package/templates/create/svelte/README.md.hbs +4 -3
- package/templates/create/svelte/src/routes/+page.server.ts.hbs +1 -2
- package/templates/create/svelte/src/routes/+page.svelte.hbs +1 -1
- package/templates/create/tanstack-start/README.md.hbs +5 -4
- package/templates/create/tanstack-start/src/routes/index.tsx.hbs +2 -2
- package/templates/create/tanstack-start/tsconfig.json +1 -1
- package/templates/create/astro/src/lib/prisma.ts.hbs +0 -73
- package/templates/create/elysia/src/lib/prisma.ts.hbs +0 -73
- package/templates/create/minimal/src/lib/prisma.ts.hbs +0 -73
- package/templates/create/nest/src/lib/prisma.ts.hbs +0 -73
- package/templates/create/next/src/lib/prisma.ts.hbs +0 -73
- package/templates/create/nuxt/server/utils/prisma.ts.hbs +0 -73
- package/templates/create/svelte/src/lib/server/prisma.ts.hbs +0 -73
- package/templates/create/tanstack-start/src/lib/prisma.server.ts.hbs +0 -73
package/README.md
CHANGED
|
@@ -24,23 +24,23 @@ plan/apply path for initial schema setup.
|
|
|
24
24
|
Use the package runner you already have:
|
|
25
25
|
|
|
26
26
|
```bash
|
|
27
|
-
npx create-prisma@next
|
|
27
|
+
npx create-prisma@next my-app
|
|
28
28
|
```
|
|
29
29
|
|
|
30
30
|
```bash
|
|
31
|
-
pnpm dlx create-prisma@next
|
|
31
|
+
pnpm dlx create-prisma@next my-app
|
|
32
32
|
```
|
|
33
33
|
|
|
34
34
|
```bash
|
|
35
|
-
yarn dlx create-prisma@next
|
|
35
|
+
yarn dlx create-prisma@next my-app
|
|
36
36
|
```
|
|
37
37
|
|
|
38
38
|
```bash
|
|
39
|
-
bunx create-prisma@next
|
|
39
|
+
bunx create-prisma@next my-app
|
|
40
40
|
```
|
|
41
41
|
|
|
42
42
|
```bash
|
|
43
|
-
deno run -A npm:create-prisma@next
|
|
43
|
+
deno run -A npm:create-prisma@next my-app
|
|
44
44
|
```
|
|
45
45
|
|
|
46
46
|
If you already have it available locally:
|
|
@@ -60,49 +60,49 @@ create-prisma
|
|
|
60
60
|
Create a Minimal project non-interactively:
|
|
61
61
|
|
|
62
62
|
```bash
|
|
63
|
-
create-prisma
|
|
63
|
+
create-prisma my-script --template minimal --provider postgres
|
|
64
64
|
```
|
|
65
65
|
|
|
66
66
|
Create a Hono app non-interactively:
|
|
67
67
|
|
|
68
68
|
```bash
|
|
69
|
-
create-prisma
|
|
69
|
+
create-prisma my-api --template hono --provider postgres
|
|
70
70
|
```
|
|
71
71
|
|
|
72
72
|
Create a MongoDB app:
|
|
73
73
|
|
|
74
74
|
```bash
|
|
75
|
-
create-prisma
|
|
75
|
+
create-prisma my-api --template hono --provider mongodb
|
|
76
76
|
```
|
|
77
77
|
|
|
78
78
|
Scaffold into the current directory:
|
|
79
79
|
|
|
80
80
|
```bash
|
|
81
|
-
create-prisma
|
|
81
|
+
create-prisma . --template hono --provider postgres
|
|
82
82
|
```
|
|
83
83
|
|
|
84
84
|
Use TypeScript contract authoring:
|
|
85
85
|
|
|
86
86
|
```bash
|
|
87
|
-
create-prisma
|
|
87
|
+
create-prisma my-app --template next --authoring typescript
|
|
88
88
|
```
|
|
89
89
|
|
|
90
90
|
Use Prisma Postgres auto-provisioning:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
create-prisma
|
|
93
|
+
create-prisma my-app --template nest --provider postgres --prisma-postgres
|
|
94
94
|
```
|
|
95
95
|
|
|
96
96
|
Target a specific Prisma Next release (useful for regression / bisect work):
|
|
97
97
|
|
|
98
98
|
```bash
|
|
99
|
-
create-prisma
|
|
99
|
+
create-prisma my-app --template hono --prisma-next-version 0.10.0
|
|
100
100
|
```
|
|
101
101
|
|
|
102
102
|
Scaffold against an open PR via pkg.pr.new:
|
|
103
103
|
|
|
104
104
|
```bash
|
|
105
|
-
create-prisma
|
|
105
|
+
create-prisma my-app --template hono --prisma-next-version pkg-pr-new:bad6795
|
|
106
106
|
```
|
|
107
107
|
|
|
108
108
|
## Supported Templates
|
|
@@ -132,7 +132,7 @@ create-prisma --name my-app --template hono --prisma-next-version pkg-pr-new:bad
|
|
|
132
132
|
|
|
133
133
|
## Useful Flags
|
|
134
134
|
|
|
135
|
-
- `--name` project name
|
|
135
|
+
- positional project name or `--name` project name / relative path
|
|
136
136
|
- `--template` choose the template
|
|
137
137
|
- `--provider postgres|postgresql|mongo|mongodb` (default: `postgres`)
|
|
138
138
|
- `--authoring psl|typescript` (default: `psl`)
|
package/dist/cli.mjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { z } from "zod";
|
|
2
3
|
import { cancel, confirm, intro, isCancel, log, note, outro, select, spinner, text } from "@clack/prompts";
|
|
3
4
|
import fs from "fs-extra";
|
|
4
5
|
import path from "node:path";
|
|
@@ -8,7 +9,6 @@ import { PostHog } from "posthog-node";
|
|
|
8
9
|
import Handlebars from "handlebars";
|
|
9
10
|
import { existsSync } from "node:fs";
|
|
10
11
|
import { fileURLToPath } from "node:url";
|
|
11
|
-
import { z } from "zod";
|
|
12
12
|
import { execa } from "execa";
|
|
13
13
|
import { styleText } from "node:util";
|
|
14
14
|
|
|
@@ -131,7 +131,7 @@ async function getAnonymousId() {
|
|
|
131
131
|
}
|
|
132
132
|
function getCommonProperties() {
|
|
133
133
|
return {
|
|
134
|
-
"cli-version": "0.4.2-next.37.
|
|
134
|
+
"cli-version": "0.4.2-next.37.108.1",
|
|
135
135
|
"node-version": process.version,
|
|
136
136
|
platform: process.platform,
|
|
137
137
|
arch: process.arch
|
|
@@ -657,7 +657,7 @@ function getPrismaNextScriptMap(packageManager) {
|
|
|
657
657
|
"db:init": `${prismaNextCli} db init`,
|
|
658
658
|
"db:update": `${prismaNextCli} db update`,
|
|
659
659
|
"db:verify": `${prismaNextCli} db verify`,
|
|
660
|
-
"db:seed": "deno run -A --env-file=.env prisma/seed.ts",
|
|
660
|
+
"db:seed": "deno run -A --env-file=.env src/prisma/seed.ts",
|
|
661
661
|
"migration:plan": `${prismaNextCli} migration plan`,
|
|
662
662
|
migrate: `${prismaNextCli} migrate`,
|
|
663
663
|
"migration:status": `${prismaNextCli} migration status`,
|
|
@@ -671,7 +671,7 @@ function getPrismaNextScriptMap(packageManager) {
|
|
|
671
671
|
"db:init": `${prismaNextCli} db init`,
|
|
672
672
|
"db:update": `${prismaNextCli} db update`,
|
|
673
673
|
"db:verify": `${prismaNextCli} db verify`,
|
|
674
|
-
"db:seed": "bun prisma/seed.ts",
|
|
674
|
+
"db:seed": "bun src/prisma/seed.ts",
|
|
675
675
|
"migration:plan": `${prismaNextCli} migration plan`,
|
|
676
676
|
migrate: `${prismaNextCli} migrate`,
|
|
677
677
|
"migration:status": `${prismaNextCli} migration status`,
|
|
@@ -683,7 +683,7 @@ function getPrismaNextScriptMap(packageManager) {
|
|
|
683
683
|
"db:init": "prisma-next db init",
|
|
684
684
|
"db:update": "prisma-next db update",
|
|
685
685
|
"db:verify": "prisma-next db verify",
|
|
686
|
-
"db:seed": "tsx prisma/seed.ts",
|
|
686
|
+
"db:seed": "tsx src/prisma/seed.ts",
|
|
687
687
|
"migration:plan": "prisma-next migration plan",
|
|
688
688
|
migrate: "prisma-next migrate",
|
|
689
689
|
"migration:status": "prisma-next migration status",
|
|
@@ -1063,17 +1063,12 @@ function getMongoMemoryScripts(packageManager) {
|
|
|
1063
1063
|
}
|
|
1064
1064
|
}
|
|
1065
1065
|
const requiredPrismaFileGroups = [
|
|
1066
|
-
["prisma/contract.prisma", "prisma/contract.ts"],
|
|
1066
|
+
["src/prisma/contract.prisma", "src/prisma/contract.ts"],
|
|
1067
1067
|
["prisma-next.config.ts"],
|
|
1068
|
-
[
|
|
1069
|
-
"src/lib/prisma.ts",
|
|
1070
|
-
"src/lib/prisma.server.ts",
|
|
1071
|
-
"src/lib/server/prisma.ts",
|
|
1072
|
-
"server/utils/prisma.ts"
|
|
1073
|
-
]
|
|
1068
|
+
["src/prisma/db.ts"]
|
|
1074
1069
|
];
|
|
1075
1070
|
function getContractPath(authoring) {
|
|
1076
|
-
return `prisma/contract${authoring === "typescript" ? ".ts" : ".prisma"}`;
|
|
1071
|
+
return `src/prisma/contract${authoring === "typescript" ? ".ts" : ".prisma"}`;
|
|
1077
1072
|
}
|
|
1078
1073
|
async function promptForDatabaseProvider() {
|
|
1079
1074
|
const databaseProvider = await select({
|
|
@@ -1591,7 +1586,7 @@ function buildNextStepsForContext(opts) {
|
|
|
1591
1586
|
});
|
|
1592
1587
|
nextSteps.push({
|
|
1593
1588
|
command: getRunScriptCommand(context.packageManager, "db:seed"),
|
|
1594
|
-
description: "Insert the sample users from prisma/seed.ts."
|
|
1589
|
+
description: "Insert the sample users from src/prisma/seed.ts."
|
|
1595
1590
|
});
|
|
1596
1591
|
if (options.includeDevNextStep) nextSteps.push({
|
|
1597
1592
|
command: getRunScriptCommand(context.packageManager, "dev"),
|
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import * as _orpc_server0 from "@orpc/server";
|
|
3
3
|
import * as trpc_cli0 from "trpc-cli";
|
|
4
|
-
import * as zod from "zod";
|
|
5
4
|
import { z } from "zod";
|
|
6
|
-
import * as zod_v4_core0 from "zod/v4/core";
|
|
7
5
|
|
|
8
6
|
//#region node_modules/@orpc/client/dist/index.d.mts
|
|
9
7
|
declare const COMMON_ORPC_ERROR_DEFS: {
|
|
@@ -249,33 +247,33 @@ type CreateCommandInput = z.infer<typeof CreateCommandInputSchema>;
|
|
|
249
247
|
//#endregion
|
|
250
248
|
//#region src/index.d.ts
|
|
251
249
|
declare const router: {
|
|
252
|
-
create: _orpc_server0.Procedure<_orpc_server0.MergedInitialContext<Record<never, never>, Record<never, never>, Record<never, never>>, Record<never, never>,
|
|
253
|
-
yes:
|
|
254
|
-
verbose:
|
|
255
|
-
provider:
|
|
250
|
+
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<{
|
|
251
|
+
yes: z.ZodOptional<z.ZodBoolean>;
|
|
252
|
+
verbose: z.ZodOptional<z.ZodBoolean>;
|
|
253
|
+
provider: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
|
|
256
254
|
postgres: "postgres";
|
|
257
255
|
postgresql: "postgresql";
|
|
258
256
|
mongo: "mongo";
|
|
259
257
|
mongodb: "mongodb";
|
|
260
|
-
}>,
|
|
261
|
-
authoring:
|
|
258
|
+
}>, z.ZodTransform<"postgres" | "mongo", "postgres" | "postgresql" | "mongo" | "mongodb">>>;
|
|
259
|
+
authoring: z.ZodOptional<z.ZodEnum<{
|
|
262
260
|
psl: "psl";
|
|
263
261
|
typescript: "typescript";
|
|
264
262
|
}>>;
|
|
265
|
-
packageManager:
|
|
263
|
+
packageManager: z.ZodOptional<z.ZodEnum<{
|
|
266
264
|
npm: "npm";
|
|
267
265
|
pnpm: "pnpm";
|
|
268
266
|
yarn: "yarn";
|
|
269
267
|
bun: "bun";
|
|
270
268
|
deno: "deno";
|
|
271
269
|
}>>;
|
|
272
|
-
prismaPostgres:
|
|
273
|
-
databaseUrl:
|
|
274
|
-
install:
|
|
275
|
-
emit:
|
|
276
|
-
prismaNextVersion:
|
|
277
|
-
name:
|
|
278
|
-
template:
|
|
270
|
+
prismaPostgres: z.ZodOptional<z.ZodBoolean>;
|
|
271
|
+
databaseUrl: z.ZodOptional<z.ZodString>;
|
|
272
|
+
install: z.ZodOptional<z.ZodBoolean>;
|
|
273
|
+
emit: z.ZodOptional<z.ZodBoolean>;
|
|
274
|
+
prismaNextVersion: z.ZodOptional<z.ZodString>;
|
|
275
|
+
name: z.ZodOptional<z.ZodString>;
|
|
276
|
+
template: z.ZodOptional<z.ZodEnum<{
|
|
279
277
|
minimal: "minimal";
|
|
280
278
|
hono: "hono";
|
|
281
279
|
elysia: "elysia";
|
|
@@ -286,8 +284,8 @@ declare const router: {
|
|
|
286
284
|
nuxt: "nuxt";
|
|
287
285
|
"tanstack-start": "tanstack-start";
|
|
288
286
|
}>>;
|
|
289
|
-
force:
|
|
290
|
-
},
|
|
287
|
+
force: z.ZodOptional<z.ZodBoolean>;
|
|
288
|
+
}, z.core.$strip>], null>, Schema<void, void>, MergedErrorMap<Record<never, never>, Record<never, never>>, Record<never, never>>;
|
|
291
289
|
};
|
|
292
290
|
declare function createCreatePrismaCli(): trpc_cli0.TrpcCli;
|
|
293
291
|
declare function create(input?: CreateCommandInput): Promise<void>;
|
package/dist/index.mjs
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-
|
|
2
|
+
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as DatabaseUrlSchema, r as CreateCommandInputSchema, s as PackageManagerSchema, t as runCreateCommand } from "./create-C7SXN6bn.mjs";
|
|
3
3
|
import { os } from "@orpc/server";
|
|
4
4
|
import { createCli } from "trpc-cli";
|
|
5
|
+
import { z } from "zod";
|
|
5
6
|
|
|
6
7
|
//#region src/index.ts
|
|
7
|
-
const CLI_VERSION = "0.4.2-next.37.
|
|
8
|
+
const CLI_VERSION = "0.4.2-next.37.108.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
|
+
}
|
|
8
17
|
const router = os.router({ create: os.meta({
|
|
9
18
|
description: "Create a new project with Prisma setup",
|
|
10
19
|
default: true,
|
|
11
20
|
negateBooleans: true
|
|
12
|
-
}).input(
|
|
13
|
-
await runCreateCommand(input
|
|
21
|
+
}).input(CreateCliInputSchema).handler(async ({ input }) => {
|
|
22
|
+
await runCreateCommand(normalizeCreateCliInput(input));
|
|
14
23
|
}) });
|
|
15
24
|
function createCreatePrismaCli() {
|
|
16
25
|
return createCli({
|
package/package.json
CHANGED
|
@@ -1,19 +1,7 @@
|
|
|
1
1
|
{{#if (requiresDotenvConfigImport packageManager)}}
|
|
2
2
|
import "dotenv/config";
|
|
3
3
|
{{/if}}
|
|
4
|
-
{{#if (eq
|
|
5
|
-
import { db } from "../server/utils/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
6
|
-
{{else}}
|
|
7
|
-
{{#if (eq template "svelte")}}
|
|
8
|
-
import { db } from "../src/lib/server/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
9
|
-
{{else}}
|
|
10
|
-
{{#if (eq template "tanstack-start")}}
|
|
11
|
-
import { db } from "../src/lib/prisma.server{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
12
|
-
{{else}}
|
|
13
|
-
import { db } from "../src/lib/prisma{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
14
|
-
{{/if}}
|
|
15
|
-
{{/if}}
|
|
16
|
-
{{/if}}
|
|
4
|
+
import { db } from "./db{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
17
5
|
|
|
18
6
|
const seedUsers = [
|
|
19
7
|
{ email: "alice@prisma.io", username: "alice", name: "Alice" },
|
|
@@ -1,9 +1,5 @@
|
|
|
1
1
|
import "dotenv/config";
|
|
2
|
-
{{#if (eq
|
|
3
|
-
import mongo from "@prisma-next/mongo/runtime";
|
|
4
|
-
{{else}}
|
|
5
|
-
import postgres from "@prisma-next/postgres/runtime";
|
|
6
|
-
{{/if}}
|
|
2
|
+
import { db } from "./db{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
7
3
|
|
|
8
4
|
{{#if (eq provider "mongo")}}
|
|
9
5
|
import type { DefaultModelRow } from "@prisma-next/mongo-orm";
|
|
@@ -11,20 +7,9 @@ import type { DefaultModelRow } from "@prisma-next/mongo-orm";
|
|
|
11
7
|
import type { DefaultModelRow } from "@prisma-next/sql-orm-client";
|
|
12
8
|
{{/if}}
|
|
13
9
|
|
|
14
|
-
import type { Contract } from "
|
|
15
|
-
import contractJson from "../../prisma/contract.json" with { type: "json" };
|
|
10
|
+
import type { Contract } from "./contract.d";
|
|
16
11
|
|
|
17
|
-
{
|
|
18
|
-
export const db = mongo<Contract>({
|
|
19
|
-
contractJson,
|
|
20
|
-
url: process.env["DATABASE_URL"]!,
|
|
21
|
-
});
|
|
22
|
-
{{else}}
|
|
23
|
-
export const db = postgres<Contract>({
|
|
24
|
-
contractJson,
|
|
25
|
-
url: process.env["DATABASE_URL"]!,
|
|
26
|
-
});
|
|
27
|
-
{{/if}}
|
|
12
|
+
export { db };
|
|
28
13
|
|
|
29
14
|
type UserRow = DefaultModelRow<Contract, "User">;
|
|
30
15
|
|
|
@@ -69,5 +54,3 @@ export async function listUsers(limit = 10) {
|
|
|
69
54
|
}
|
|
70
55
|
|
|
71
56
|
export type StarterUser = Awaited<ReturnType<typeof listUsers>>[number];
|
|
72
|
-
|
|
73
|
-
export default db;
|
|
@@ -13,9 +13,11 @@ Generated by `create-prisma` with the Astro template.
|
|
|
13
13
|
|
|
14
14
|
Prisma Next setup is scaffolded in:
|
|
15
15
|
|
|
16
|
-
- `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
16
|
+
- `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
17
17
|
- `prisma-next.config.ts`
|
|
18
|
-
- `src/
|
|
18
|
+
- `src/prisma/db.ts`
|
|
19
|
+
- `src/prisma/users.ts`
|
|
20
|
+
- `src/prisma/seed.ts`
|
|
19
21
|
- `src/pages/api/users.ts`
|
|
20
22
|
|
|
21
23
|
Database helper scripts are added to `package.json`:
|
|
@@ -42,4 +44,3 @@ The Astro Vite dev server also auto-emits Prisma Next contract artifacts when th
|
|
|
42
44
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
43
45
|
|
|
44
46
|
The starter page queries a basic `User` model in `src/pages/index.astro`, and `src/pages/api/users.ts` shows an Astro API route backed by the same Prisma Next helper.
|
|
45
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { APIRoute } from "astro";
|
|
2
2
|
|
|
3
|
-
import { listUsers } from "../../
|
|
3
|
+
import { listUsers } from "../../prisma/users";
|
|
4
4
|
|
|
5
5
|
export const GET: APIRoute = async () => {
|
|
6
6
|
const users = await listUsers(10).catch((error) => {
|
|
@@ -23,4 +23,3 @@ export const GET: APIRoute = async () => {
|
|
|
23
23
|
},
|
|
24
24
|
});
|
|
25
25
|
};
|
|
26
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
|
|
3
|
-
import { listUsers } from "../
|
|
3
|
+
import { listUsers } from "../prisma/users";
|
|
4
4
|
|
|
5
5
|
const formatter = new Intl.DateTimeFormat("en", {
|
|
6
6
|
dateStyle: "medium",
|
|
@@ -27,7 +27,7 @@ const users = await listUsers(10).catch(() => undefined);
|
|
|
27
27
|
<h1>Users from your database, loaded on the server.</h1>
|
|
28
28
|
<p class="lede">
|
|
29
29
|
This page reads from <code>src/pages/index.astro</code> using the Prisma Next helper in
|
|
30
|
-
<code>src/
|
|
30
|
+
<code>src/prisma/users.ts</code>. An Astro API route is also scaffolded in
|
|
31
31
|
<code>src/pages/api/users.ts</code>.
|
|
32
32
|
</p>
|
|
33
33
|
</div>
|
|
@@ -12,9 +12,11 @@ Generated by `create-prisma` with the Elysia template.
|
|
|
12
12
|
|
|
13
13
|
Prisma Next setup is scaffolded in:
|
|
14
14
|
|
|
15
|
-
- `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
15
|
+
- `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
16
16
|
- `prisma-next.config.ts`
|
|
17
|
-
- `src/
|
|
17
|
+
- `src/prisma/db.ts`
|
|
18
|
+
- `src/prisma/users.ts`
|
|
19
|
+
- `src/prisma/seed.ts`
|
|
18
20
|
|
|
19
21
|
Database helper scripts are added to `package.json`:
|
|
20
22
|
|
|
@@ -39,4 +41,3 @@ For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma N
|
|
|
39
41
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
40
42
|
|
|
41
43
|
The template includes a basic `User` model and a sample `GET /users` endpoint.
|
|
42
|
-
|
|
@@ -7,7 +7,7 @@ import { node } from "@elysiajs/node";
|
|
|
7
7
|
{{/if}}
|
|
8
8
|
import { Elysia } from "elysia";
|
|
9
9
|
|
|
10
|
-
import { listUsers } from "./
|
|
10
|
+
import { listUsers } from "./prisma/users{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
11
11
|
|
|
12
12
|
const rawPort = ({{#if (eq packageManager "deno")}}Deno.env.get("PORT"){{else}}process.env.PORT{{/if}} ?? "").trim();
|
|
13
13
|
const parsedPort = rawPort.length > 0 ? Number(rawPort) : Number.NaN;
|
|
@@ -12,9 +12,11 @@ Generated by `create-prisma` with the Hono template.
|
|
|
12
12
|
|
|
13
13
|
Prisma Next setup is scaffolded in:
|
|
14
14
|
|
|
15
|
-
- `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
15
|
+
- `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
16
16
|
- `prisma-next.config.ts`
|
|
17
|
-
- `src/
|
|
17
|
+
- `src/prisma/db.ts`
|
|
18
|
+
- `src/prisma/users.ts`
|
|
19
|
+
- `src/prisma/seed.ts`
|
|
18
20
|
|
|
19
21
|
Database helper scripts are added to `package.json`:
|
|
20
22
|
|
|
@@ -39,4 +41,3 @@ For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma N
|
|
|
39
41
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
40
42
|
|
|
41
43
|
The template includes a basic `User` model and a sample `GET /users` endpoint.
|
|
42
|
-
|
|
@@ -4,7 +4,7 @@ import "dotenv/config";
|
|
|
4
4
|
import { serve } from "@hono/node-server";
|
|
5
5
|
import { Hono } from "hono";
|
|
6
6
|
|
|
7
|
-
import { listUsers } from "./
|
|
7
|
+
import { listUsers } from "./prisma/users{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
8
8
|
|
|
9
9
|
const app = new Hono();
|
|
10
10
|
|
|
@@ -10,10 +10,11 @@ Generated by `create-prisma` with the Minimal template.
|
|
|
10
10
|
|
|
11
11
|
Prisma Next setup is scaffolded in:
|
|
12
12
|
|
|
13
|
-
- `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
13
|
+
- `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
14
14
|
- `prisma-next.config.ts`
|
|
15
|
-
- `prisma/db.ts`
|
|
16
|
-
- `src/
|
|
15
|
+
- `src/prisma/db.ts`
|
|
16
|
+
- `src/prisma/users.ts`
|
|
17
|
+
- `src/prisma/seed.ts`
|
|
17
18
|
|
|
18
19
|
Database helper scripts are added to `package.json`:
|
|
19
20
|
|
|
@@ -12,9 +12,11 @@ Generated by `create-prisma` with the NestJS template.
|
|
|
12
12
|
|
|
13
13
|
Prisma Next setup is scaffolded in:
|
|
14
14
|
|
|
15
|
-
- `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
15
|
+
- `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
16
16
|
- `prisma-next.config.ts`
|
|
17
|
-
- `src/
|
|
17
|
+
- `src/prisma/db.ts`
|
|
18
|
+
- `src/prisma/users.ts`
|
|
19
|
+
- `src/prisma/seed.ts`
|
|
18
20
|
- `src/prisma.service.ts`
|
|
19
21
|
|
|
20
22
|
Database helper scripts are added to `package.json`:
|
|
@@ -40,4 +42,3 @@ For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma N
|
|
|
40
42
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
41
43
|
|
|
42
44
|
The template includes a basic `User` model and a sample `GET /users` endpoint.
|
|
43
|
-
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Injectable } from "@nestjs/common";
|
|
2
|
-
import { db, listUsers, type StarterUser } from "./
|
|
2
|
+
import { db, listUsers, type StarterUser } from "./prisma/users{{#if (eq packageManager "deno")}}.ts{{/if}}";
|
|
3
3
|
|
|
4
4
|
@Injectable()
|
|
5
5
|
export class PrismaService {
|
|
@@ -12,9 +12,11 @@ Generated by `create-prisma` with the Next.js template.
|
|
|
12
12
|
|
|
13
13
|
Prisma Next setup is scaffolded in:
|
|
14
14
|
|
|
15
|
-
- `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
15
|
+
- `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
16
16
|
- `prisma-next.config.ts`
|
|
17
|
-
- `src/
|
|
17
|
+
- `src/prisma/db.ts`
|
|
18
|
+
- `src/prisma/users.ts`
|
|
19
|
+
- `src/prisma/seed.ts`
|
|
18
20
|
|
|
19
21
|
Database helper scripts are added to `package.json`:
|
|
20
22
|
|
|
@@ -39,4 +41,3 @@ For provider-specific Prisma Next reference docs, see `prisma-next.md`. Prisma N
|
|
|
39
41
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
40
42
|
|
|
41
43
|
The starter page in `src/app/page.tsx` reads from a basic `User` model so you can verify queries quickly after you initialize and apply your schema.
|
|
42
|
-
|
|
@@ -5,7 +5,7 @@ export const dynamic = "force-dynamic";
|
|
|
5
5
|
|
|
6
6
|
export default async function Home() {
|
|
7
7
|
|
|
8
|
-
const { listUsers } = await import("../
|
|
8
|
+
const { listUsers } = await import("../prisma/users");
|
|
9
9
|
const formatter = new Intl.DateTimeFormat("en", {
|
|
10
10
|
dateStyle: "medium",
|
|
11
11
|
timeStyle: "short",
|
|
@@ -20,7 +20,7 @@ export default async function Home() {
|
|
|
20
20
|
<h1>Users from your database, loaded on the server.</h1>
|
|
21
21
|
<p className="lede">
|
|
22
22
|
This page reads from <code>src/app/page.tsx</code> using the Prisma Next helper in{" "}
|
|
23
|
-
<code>src/
|
|
23
|
+
<code>src/prisma/users.ts</code>.
|
|
24
24
|
</p>
|
|
25
25
|
</div>
|
|
26
26
|
|
|
@@ -13,9 +13,11 @@ Generated by `create-prisma` with the Nuxt template.
|
|
|
13
13
|
|
|
14
14
|
Prisma Next setup is scaffolded in:
|
|
15
15
|
|
|
16
|
-
- `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
16
|
+
- `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
17
17
|
- `prisma-next.config.ts`
|
|
18
|
-
- `
|
|
18
|
+
- `src/prisma/db.ts`
|
|
19
|
+
- `src/prisma/users.ts`
|
|
20
|
+
- `src/prisma/seed.ts`
|
|
19
21
|
- `server/api/users.get.ts`
|
|
20
22
|
|
|
21
23
|
Database helper scripts are added to `package.json`:
|
|
@@ -42,4 +44,3 @@ The Nuxt Vite dev server also auto-emits Prisma Next contract artifacts when the
|
|
|
42
44
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
43
45
|
|
|
44
46
|
The starter page in `app/pages/index.vue` fetches users from `server/api/users.get.ts` after you initialize and apply your schema.
|
|
45
|
-
|
|
@@ -37,7 +37,7 @@ function formatCreatedAt(value: string): string {
|
|
|
37
37
|
<h1>Users from your database, loaded through Nitro.</h1>
|
|
38
38
|
<p class="lede">
|
|
39
39
|
This page fetches <code>/api/users</code> from <code>server/api/users.get.ts</code> using
|
|
40
|
-
the Prisma Next helper in <code>
|
|
40
|
+
the Prisma Next helper in <code>src/prisma/users.ts</code>.
|
|
41
41
|
</p>
|
|
42
42
|
</div>
|
|
43
43
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { listUsers } from "
|
|
1
|
+
import { listUsers } from "../../src/prisma/users";
|
|
2
2
|
|
|
3
3
|
export default defineEventHandler(async () => {
|
|
4
4
|
const users = await listUsers(10)
|
|
@@ -22,4 +22,3 @@ export default defineEventHandler(async () => {
|
|
|
22
22
|
|
|
23
23
|
return { users };
|
|
24
24
|
});
|
|
25
|
-
|
|
@@ -13,9 +13,11 @@ Generated by `create-prisma` with the SvelteKit template.
|
|
|
13
13
|
|
|
14
14
|
Prisma Next setup is scaffolded in:
|
|
15
15
|
|
|
16
|
-
- `prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
16
|
+
- `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
17
17
|
- `prisma-next.config.ts`
|
|
18
|
-
- `src/
|
|
18
|
+
- `src/prisma/db.ts`
|
|
19
|
+
- `src/prisma/users.ts`
|
|
20
|
+
- `src/prisma/seed.ts`
|
|
19
21
|
|
|
20
22
|
Database helper scripts are added to `package.json`:
|
|
21
23
|
|
|
@@ -41,4 +43,3 @@ The SvelteKit Vite dev server also auto-emits Prisma Next contract artifacts whe
|
|
|
41
43
|
Node-based Prisma Next projects expect Node.js 24 LTS or newer.
|
|
42
44
|
|
|
43
45
|
The starter page loads users in `+page.server.ts` and renders them in `+page.svelte` after you initialize and apply your schema.
|
|
44
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PageServerLoad } from "./$types";
|
|
2
2
|
|
|
3
|
-
import { listUsers } from "
|
|
3
|
+
import { listUsers } from "../prisma/users";
|
|
4
4
|
|
|
5
5
|
export const load: PageServerLoad = async () => {
|
|
6
6
|
const users = await listUsers(10)
|
|
@@ -14,4 +14,3 @@ export const load: PageServerLoad = async () => {
|
|
|
14
14
|
|
|
15
15
|
return { users };
|
|
16
16
|
};
|
|
17
|
-
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<h1>Users from your database, loaded on the server.</h1>
|
|
22
22
|
<p class="lede">
|
|
23
23
|
This page reads from <code>+page.server.ts</code> using the Prisma Next helper in
|
|
24
|
-
<code>src/
|
|
24
|
+
<code>src/prisma/users.ts</code>.
|
|
25
25
|
</p>
|
|
26
26
|
</div>
|
|
27
27
|
|