create-prisma 0.9.4 → 0.9.5-pr.70.248.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 +4 -2
- package/dist/cli.mjs +1 -1
- package/dist/{create-Ba53NkCH.mjs → create-Gk-6-J4c.mjs} +18 -38
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/templates/create/_shared/README.md.hbs +1 -1
- package/templates/create/_shared/pnpm-workspace.yaml.hbs +1 -1
- package/templates/create/_shared/prisma.config.ts.hbs +18 -2
- package/templates/create/_shared/src/prisma/users.ts.hbs +3 -3
- package/templates/create/astro/src/pages/index.astro.hbs +2 -2
- package/templates/create/next/src/app/page.tsx.hbs +2 -2
- package/templates/create/nuxt/server/api/users.get.ts.hbs +1 -1
- package/templates/create/svelte/src/routes/+page.server.ts.hbs +1 -1
- package/templates/create/tanstack-start/src/routes/index.tsx.hbs +1 -1
package/README.md
CHANGED
|
@@ -44,10 +44,12 @@ PostgreSQL and MongoDB are supported with PSL or TypeScript contract authoring.
|
|
|
44
44
|
Deno is supported for local minimal PostgreSQL apps:
|
|
45
45
|
|
|
46
46
|
```bash
|
|
47
|
-
deno run -A npm:create-prisma@latest my-deno-app --template minimal --provider postgres --package-manager deno --no-deploy
|
|
47
|
+
deno run -A --minimum-dependency-age=0 npm:create-prisma@latest my-deno-app --template minimal --provider postgres --package-manager deno --no-deploy
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
Deno 2.9 blocks packages published within the previous 24 hours by default. The explicit
|
|
51
|
+
dependency-age flag ensures a newly published `create-prisma` release is selected instead of an
|
|
52
|
+
older cached version. Prisma Compute does not support Deno deployments yet.
|
|
51
53
|
|
|
52
54
|
## Options
|
|
53
55
|
|
package/dist/cli.mjs
CHANGED
|
@@ -14,21 +14,12 @@ import { createInterface } from "node:readline";
|
|
|
14
14
|
import { styleText } from "node:util";
|
|
15
15
|
|
|
16
16
|
//#region src/telemetry/client.ts
|
|
17
|
-
const TELEMETRY_API_KEY = "
|
|
17
|
+
const TELEMETRY_API_KEY = "";
|
|
18
18
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
19
19
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
20
20
|
const UUID_V4_REGEX = /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
|
|
21
|
-
function isTruthyEnvValue(value) {
|
|
22
|
-
return [
|
|
23
|
-
"1",
|
|
24
|
-
"true",
|
|
25
|
-
"yes",
|
|
26
|
-
"on"
|
|
27
|
-
].includes(String(value ?? "").trim().toLowerCase());
|
|
28
|
-
}
|
|
29
21
|
function shouldDisableTelemetry() {
|
|
30
|
-
|
|
31
|
-
return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
|
|
22
|
+
return true;
|
|
32
23
|
}
|
|
33
24
|
function getTelemetryConfigDir() {
|
|
34
25
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -50,7 +41,7 @@ async function getAnonymousId() {
|
|
|
50
41
|
}
|
|
51
42
|
function getCommonProperties() {
|
|
52
43
|
return {
|
|
53
|
-
"cli-version": "0.9.
|
|
44
|
+
"cli-version": "0.9.5-pr.70.248.1",
|
|
54
45
|
"node-version": process.version,
|
|
55
46
|
platform: process.platform,
|
|
56
47
|
arch: process.arch
|
|
@@ -193,6 +184,7 @@ const CreateCommandInputSchema = PrismaSetupCommandInputSchema.extend(CreateScaf
|
|
|
193
184
|
|
|
194
185
|
//#endregion
|
|
195
186
|
//#region src/utils/package-manager.ts
|
|
187
|
+
const DENO_ALLOW_FRESH_DEPENDENCIES = "--minimum-dependency-age=0";
|
|
196
188
|
const packageManagerManifestValues = {
|
|
197
189
|
npm: "npm@10.9.0",
|
|
198
190
|
pnpm: "pnpm@11.21.0",
|
|
@@ -305,7 +297,7 @@ function getRuntimeScriptCommand(packageManager, kind, options) {
|
|
|
305
297
|
function getInstallArgs(packageManager) {
|
|
306
298
|
if (packageManager === "deno") return {
|
|
307
299
|
command: "deno",
|
|
308
|
-
args: ["install"]
|
|
300
|
+
args: ["install", DENO_ALLOW_FRESH_DEPENDENCIES]
|
|
309
301
|
};
|
|
310
302
|
return {
|
|
311
303
|
command: packageManager,
|
|
@@ -322,6 +314,7 @@ function getPackageExecutionArgs(packageManager, commandArgs) {
|
|
|
322
314
|
args: [
|
|
323
315
|
"run",
|
|
324
316
|
"-A",
|
|
317
|
+
DENO_ALLOW_FRESH_DEPENDENCIES,
|
|
325
318
|
`npm:${packageName}`,
|
|
326
319
|
...args
|
|
327
320
|
]
|
|
@@ -480,26 +473,26 @@ async function scaffoldCreateFrameworkTemplate(opts) {
|
|
|
480
473
|
const dependencyVersionMap = {
|
|
481
474
|
"@astrojs/node": "^10.0.2",
|
|
482
475
|
"@elysiajs/node": "^1.4.5",
|
|
483
|
-
"@prisma/composer": "0.
|
|
484
|
-
"@prisma/composer-prisma-cloud": "0.
|
|
485
|
-
"@prisma/orm-mongo": "8.0.0-rc.
|
|
486
|
-
"@prisma/orm-postgres": "8.0.0-rc.
|
|
476
|
+
"@prisma/composer": "0.15.0",
|
|
477
|
+
"@prisma/composer-prisma-cloud": "0.15.0",
|
|
478
|
+
"@prisma/orm-mongo": "8.0.0-rc.8",
|
|
479
|
+
"@prisma/orm-postgres": "8.0.0-rc.8",
|
|
487
480
|
"@sveltejs/adapter-node": "^5.3.2",
|
|
488
481
|
"@types/node": "^25.6.2",
|
|
489
482
|
alchemy: "2.0.0-beta.74",
|
|
490
483
|
arktype: "^2.2.3",
|
|
491
484
|
dotenv: "^17.4.2",
|
|
492
485
|
esbuild: "^0.28.1",
|
|
493
|
-
effect: "4.0.0-rc.
|
|
486
|
+
effect: "4.0.0-rc.112",
|
|
494
487
|
mongodb: "^7.1.0",
|
|
495
488
|
"mongodb-memory-server": "^11.1.0",
|
|
496
489
|
nitro: "^3.0.260610-beta",
|
|
497
|
-
prisma: "8.0.0-rc.
|
|
490
|
+
prisma: "8.0.0-rc.11",
|
|
498
491
|
tsx: "^4.21.0",
|
|
499
492
|
typescript: "^5.9.3"
|
|
500
493
|
};
|
|
501
|
-
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@8.0.0-rc.
|
|
502
|
-
const PRISMA_DENO_CLI_PACKAGE =
|
|
494
|
+
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@8.0.0-rc.11";
|
|
495
|
+
const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
|
|
503
496
|
function getDependencyVersion(packageName) {
|
|
504
497
|
return dependencyVersionMap[packageName];
|
|
505
498
|
}
|
|
@@ -555,7 +548,7 @@ function getPrismaScriptMap(packageManager) {
|
|
|
555
548
|
"db:update": prismaCommand(true, "db", "update"),
|
|
556
549
|
"db:verify": prismaCommand(true, "db", "verify"),
|
|
557
550
|
"migration:plan": prismaCommand(true, "migration", "plan"),
|
|
558
|
-
migrate: prismaCommand(true, "migrate"),
|
|
551
|
+
migrate: prismaCommand(true, "db", "migrate"),
|
|
559
552
|
"migration:status": prismaCommand(true, "migration", "status"),
|
|
560
553
|
"migration:show": prismaCommand(true, "migration", "show")
|
|
561
554
|
};
|
|
@@ -627,7 +620,7 @@ async function writePrismaDependencies(provider, packageManager, _authoring, pro
|
|
|
627
620
|
if (packageManager === "deno") dependencies.push("dotenv");
|
|
628
621
|
await addPackageDependency({
|
|
629
622
|
dependencies,
|
|
630
|
-
devDependencies:
|
|
623
|
+
devDependencies: ["@types/node", "prisma"],
|
|
631
624
|
scripts: getPrismaScriptMap(packageManager),
|
|
632
625
|
projectDir
|
|
633
626
|
});
|
|
@@ -1149,19 +1142,7 @@ function getPrismaCliInvocation(packageManager, args) {
|
|
|
1149
1142
|
return getPackageExecutionArgs(packageManager, [packageManager === "deno" ? PRISMA_DENO_CLI_PACKAGE : PRISMA_PLATFORM_CLI_PACKAGE, ...args]);
|
|
1150
1143
|
}
|
|
1151
1144
|
async function runPrismaInit(context, projectDir) {
|
|
1152
|
-
const args =
|
|
1153
|
-
"init",
|
|
1154
|
-
"--yes",
|
|
1155
|
-
"--no-interactive",
|
|
1156
|
-
"--target",
|
|
1157
|
-
getInitTarget(context.databaseProvider),
|
|
1158
|
-
"--authoring",
|
|
1159
|
-
context.authoring,
|
|
1160
|
-
"--schema-path",
|
|
1161
|
-
getContractPath(context.authoring),
|
|
1162
|
-
"--no-install",
|
|
1163
|
-
"--no-skill"
|
|
1164
|
-
] : [
|
|
1145
|
+
const args = [
|
|
1165
1146
|
"orm",
|
|
1166
1147
|
"init",
|
|
1167
1148
|
"--yes",
|
|
@@ -1172,8 +1153,7 @@ async function runPrismaInit(context, projectDir) {
|
|
|
1172
1153
|
context.authoring,
|
|
1173
1154
|
"--schema-path",
|
|
1174
1155
|
getContractPath(context.authoring),
|
|
1175
|
-
"--skip-install"
|
|
1176
|
-
"--skip-skills"
|
|
1156
|
+
"--skip-install"
|
|
1177
1157
|
];
|
|
1178
1158
|
const invocation = getPrismaCliInvocation(context.packageManager, args);
|
|
1179
1159
|
if (context.verbose) log.step(`Running ${[invocation.command, ...invocation.args].join(" ")}`);
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-
|
|
2
|
+
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, t as runCreateCommand } from "./create-Gk-6-J4c.mjs";
|
|
3
3
|
import { os } from "@orpc/server";
|
|
4
4
|
import { createCli } from "trpc-cli";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
//#region src/index.ts
|
|
8
|
-
const CLI_VERSION = "0.9.
|
|
8
|
+
const CLI_VERSION = "0.9.5-pr.70.248.1";
|
|
9
9
|
const CreateCliInputSchema = z.tuple([z.string().trim().min(1, "Please enter a valid project name").optional().describe("Project name / directory"), CreateCommandInputSchema]);
|
|
10
10
|
function normalizeCreateCliInput(input) {
|
|
11
11
|
const [projectName, options] = input;
|
package/package.json
CHANGED
|
@@ -22,7 +22,7 @@ The starter users are inserted idempotently from `src/prisma/seed.ts` on the fir
|
|
|
22
22
|
## Prisma
|
|
23
23
|
|
|
24
24
|
- Contract: `src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}`
|
|
25
|
-
- Prisma config: `prisma
|
|
25
|
+
- Prisma config: `prisma.config.ts`
|
|
26
26
|
|
|
27
27
|
After changing the contract, run:
|
|
28
28
|
|
|
@@ -1,4 +1,20 @@
|
|
|
1
|
-
{{#
|
|
1
|
+
{{#if (eq packageManager "deno")}}
|
|
2
|
+
import "dotenv/config";
|
|
3
|
+
import { definePrismaConfig } from "prisma/config";
|
|
4
|
+
import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
|
|
5
|
+
|
|
6
|
+
export default definePrismaConfig({
|
|
7
|
+
orm: ormConfig({
|
|
8
|
+
contract: "./src/prisma/contract{{#if (eq authoring "typescript")}}.ts{{else}}.prisma{{/if}}",
|
|
9
|
+
{{#if (eq authoring "typescript")}}
|
|
10
|
+
output: "./src/prisma/generated",
|
|
11
|
+
{{/if}}
|
|
12
|
+
db: {
|
|
13
|
+
connection: process.env.{{#if (eq provider "postgres")}}DATABASE_URL{{else}}MONGODB_URL{{/if}}!,
|
|
14
|
+
},
|
|
15
|
+
}),
|
|
16
|
+
});
|
|
17
|
+
{{else}}
|
|
2
18
|
import { definePrismaConfig } from "prisma/config";
|
|
3
19
|
import { defineConfig as ormConfig } from "@prisma/orm-{{#if (eq provider "postgres")}}postgres{{else}}mongo{{/if}}/config";
|
|
4
20
|
|
|
@@ -19,4 +35,4 @@ export default definePrismaConfig({
|
|
|
19
35
|
configPath: "./prisma-composer.config.ts",
|
|
20
36
|
},
|
|
21
37
|
});
|
|
22
|
-
{{/
|
|
38
|
+
{{/if}}
|
|
@@ -8,19 +8,19 @@ export async function listUsers(limit = 10) {
|
|
|
8
8
|
{{#if (eq provider "mongo")}}
|
|
9
9
|
const users = [];
|
|
10
10
|
|
|
11
|
-
for await (const user of db.orm.users.select("_id", "email", "username", "name").
|
|
11
|
+
for await (const user of db.orm.users.select("_id", "email", "username", "name").limit(limit).all()) {
|
|
12
12
|
users.push({
|
|
13
13
|
id: String(user._id),
|
|
14
14
|
email: user.email,
|
|
15
15
|
username: user.username ?? null,
|
|
16
16
|
name: user.name ?? null,
|
|
17
|
-
createdAt: null as
|
|
17
|
+
createdAt: null as string | null,
|
|
18
18
|
});
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
return users;
|
|
22
22
|
{{else}}
|
|
23
|
-
const users = await db.orm.public.User.select("id", "email", "username", "name", "createdAt").
|
|
23
|
+
const users = await db.orm.public.User.select("id", "email", "username", "name", "createdAt").limit(limit).all();
|
|
24
24
|
|
|
25
25
|
return users.map((user) => ({
|
|
26
26
|
id: String(user.id),
|
|
@@ -54,8 +54,8 @@ const users = await listUsers(10).catch(() => undefined);
|
|
|
54
54
|
<p>{user.username ? `@${user.username}` : user.email}</p>
|
|
55
55
|
</div>
|
|
56
56
|
{user.createdAt ? (
|
|
57
|
-
<time datetime={user.createdAt
|
|
58
|
-
{formatter.format(user.createdAt)}
|
|
57
|
+
<time datetime={user.createdAt}>
|
|
58
|
+
{formatter.format(new Date(user.createdAt))}
|
|
59
59
|
</time>
|
|
60
60
|
) : (
|
|
61
61
|
<span class="muted">No timestamp</span>
|
|
@@ -43,8 +43,8 @@ export default async function Home() {
|
|
|
43
43
|
<p>{user.username ? `@${user.username}` : user.email}</p>
|
|
44
44
|
</div>
|
|
45
45
|
{user.createdAt ? (
|
|
46
|
-
<time dateTime={user.createdAt
|
|
47
|
-
{formatter.format(user.createdAt)}
|
|
46
|
+
<time dateTime={user.createdAt}>
|
|
47
|
+
{formatter.format(new Date(user.createdAt))}
|
|
48
48
|
</time>
|
|
49
49
|
) : (
|
|
50
50
|
<span className="empty">No timestamp</span>
|