create-prisma 0.7.1-pr.52.167.1 → 0.7.1-pr.52.169.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 +8 -10
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +1 -19
- package/dist/index.mjs +2 -2
- package/dist/{src-BZW88NIr.mjs → src-8s8Pt9Xh.mjs} +88 -123
- package/package.json +2 -1
- package/templates/create/astro/README.md.hbs +2 -4
- package/templates/create/astro/prisma/schema.prisma.hbs +0 -2
- package/templates/create/astro/prisma/seed.ts.hbs +0 -4
- package/templates/create/astro/src/pages/api/users.ts.hbs +1 -11
- package/templates/create/astro/src/pages/index.astro.hbs +1 -38
- package/templates/create/elysia/README.md.hbs +1 -2
- package/templates/create/elysia/prisma/schema.prisma.hbs +0 -2
- package/templates/create/elysia/prisma/seed.ts.hbs +0 -4
- package/templates/create/elysia/src/index.ts.hbs +3 -4
- package/templates/create/hono/README.md.hbs +1 -2
- package/templates/create/hono/prisma/schema.prisma.hbs +0 -2
- package/templates/create/hono/prisma/seed.ts.hbs +0 -4
- package/templates/create/hono/src/index.ts.hbs +1 -4
- package/templates/create/nest/README.md.hbs +1 -2
- package/templates/create/nest/prisma/schema.prisma.hbs +0 -2
- package/templates/create/nest/prisma/seed.ts.hbs +0 -4
- package/templates/create/nest/src/app.module.ts.hbs +3 -10
- package/templates/create/nest/src/users.controller.ts.hbs +0 -2
- package/templates/create/nest/src/users.service.ts.hbs +0 -2
- package/templates/create/next/README.md.hbs +3 -2
- package/templates/create/next/prisma/schema.prisma.hbs +0 -2
- package/templates/create/next/prisma/seed.ts.hbs +0 -4
- package/templates/create/next/src/app/page.tsx.hbs +2 -38
- package/templates/create/nuxt/README.md.hbs +3 -2
- package/templates/create/nuxt/app/pages/index.vue.hbs +2 -38
- package/templates/create/nuxt/prisma/schema.prisma.hbs +0 -2
- package/templates/create/nuxt/prisma/seed.ts.hbs +0 -4
- package/templates/create/nuxt/server/api/users.get.ts.hbs +0 -6
- package/templates/create/svelte/README.md.hbs +10 -3
- package/templates/create/svelte/module.ts.hbs +32 -0
- package/templates/create/svelte/package.json.hbs +8 -1
- package/templates/create/svelte/prisma/schema.prisma.hbs +0 -2
- package/templates/create/svelte/prisma/seed.ts.hbs +0 -4
- package/templates/create/svelte/prisma-composer.config.ts.hbs +10 -0
- package/templates/create/svelte/service.ts.hbs +21 -0
- package/templates/create/svelte/src/lib/server/prisma.ts.hbs +20 -0
- package/templates/create/svelte/src/routes/+page.server.ts.hbs +1 -7
- package/templates/create/svelte/src/routes/+page.svelte.hbs +0 -155
- package/templates/create/svelte/svelte.config.js.hbs +14 -0
- package/templates/create/tanstack-start/README.md.hbs +3 -2
- package/templates/create/tanstack-start/prisma/schema.prisma.hbs +0 -2
- package/templates/create/tanstack-start/prisma/seed.ts.hbs +0 -4
- package/templates/create/tanstack-start/src/routes/index.tsx.hbs +5 -45
- package/templates/create/turborepo/README.md.hbs +3 -1
- package/templates/create/turborepo/apps/api/src/index.ts.hbs +1 -4
- package/templates/create/turborepo/packages/db/prisma/schema.prisma.hbs +0 -2
- package/templates/create/turborepo/packages/db/prisma/seed.ts.hbs +0 -4
- package/templates/shared/setup-composer-postgres.mjs.hbs +156 -0
- package/templates/create/svelte/svelte.config.js +0 -13
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ Scaffold a new app with Prisma already wired up.
|
|
|
12
12
|
- writes a Prisma client singleton in the right place for the selected template
|
|
13
13
|
- adds `db:generate`, `db:migrate`, and `db:seed` scripts
|
|
14
14
|
- creates or updates the template env file with `DATABASE_URL`
|
|
15
|
-
-
|
|
15
|
+
- installs dependencies when requested and generates Prisma Client automatically
|
|
16
16
|
- can deploy the finished app and its Prisma Postgres database with Prisma Composer
|
|
17
17
|
|
|
18
18
|
## Quick Start
|
|
@@ -71,10 +71,10 @@ Create a monorepo with a shared Prisma package:
|
|
|
71
71
|
create-prisma --name my-monorepo --template turborepo --provider postgresql
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
Use Prisma Postgres auto-provisioning:
|
|
74
|
+
Use Prisma Postgres auto-provisioning, which is the PostgreSQL default:
|
|
75
75
|
|
|
76
76
|
```bash
|
|
77
|
-
create-prisma --name my-app --template nest --provider postgresql
|
|
77
|
+
create-prisma --name my-app --template nest --provider postgresql
|
|
78
78
|
```
|
|
79
79
|
|
|
80
80
|
Deploy a supported app with Prisma Composer:
|
|
@@ -83,7 +83,7 @@ Deploy a supported app with Prisma Composer:
|
|
|
83
83
|
create-prisma --name my-api --template hono --provider postgresql --deploy
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
With PostgreSQL and no `--database-url`,
|
|
86
|
+
With PostgreSQL and no `--database-url`, Prisma Postgres is included automatically. When deploying immediately, Composer provisions the database as part of the application graph, injects its connection into the service, then create-prisma applies the starter migration and seed. Pass `--database-url` to bind an existing database instead.
|
|
87
87
|
|
|
88
88
|
## Supported Templates
|
|
89
89
|
|
|
@@ -103,6 +103,7 @@ Prisma Composer files are included by default, and deployment is supported for:
|
|
|
103
103
|
- `elysia`
|
|
104
104
|
- `nest`
|
|
105
105
|
- `next`
|
|
106
|
+
- `svelte`
|
|
106
107
|
- `astro`
|
|
107
108
|
- `nuxt`
|
|
108
109
|
- `tanstack-start`
|
|
@@ -132,12 +133,9 @@ Composer generation and deployment currently apply to the Node-compatible packag
|
|
|
132
133
|
- `--template` choose the template
|
|
133
134
|
- `--provider` choose the database provider
|
|
134
135
|
- `--package-manager` choose the package manager/runtime
|
|
135
|
-
- `--schema-preset empty|basic`
|
|
136
136
|
- `--deploy` deploy supported templates with Prisma Composer
|
|
137
137
|
- `--yes` accept defaults and skip prompts
|
|
138
138
|
- `--no-install` scaffold only
|
|
139
|
-
- `--no-generate` skip `prisma generate`
|
|
140
|
-
- `--prisma-postgres` provision Prisma Postgres for PostgreSQL
|
|
141
139
|
- `--skills --mcp --extension` enable optional add-ons
|
|
142
140
|
- `--force` allow scaffolding into a non-empty directory
|
|
143
141
|
- `--verbose` print full command output
|
|
@@ -163,11 +161,11 @@ Accept the deploy prompt when it appears, or pass the flag:
|
|
|
163
161
|
create-prisma --name my-api --template hono --provider postgresql --deploy
|
|
164
162
|
```
|
|
165
163
|
|
|
166
|
-
Deployment requires `PRISMA_SERVICE_TOKEN` and `PRISMA_WORKSPACE_ID`. With PostgreSQL and no `--database-url`,
|
|
164
|
+
Deployment requires `PRISMA_SERVICE_TOKEN` and `PRISMA_WORKSPACE_ID`. With PostgreSQL and no `--database-url`, Composer provisions Prisma Postgres and passes its connection through `service.load()`. After the first deployment, create-prisma writes a direct connection to the Prisma env file and automatically runs the starter migration and seed. Other database configurations are passed through a secret Composer service input.
|
|
167
165
|
|
|
168
|
-
A `deploy` script is generated for npm, pnpm, Yarn, and Bun. It
|
|
166
|
+
A `deploy` script is generated for npm, pnpm, Yarn, and Bun. It builds and deploys the Composer application, then resolves the Composer-managed Prisma Postgres connection, applies the starter migration, and seeds the database.
|
|
169
167
|
|
|
170
|
-
The only Composer-specific prompt asks whether to deploy immediately. It is skipped in `--yes` runs unless you pass `--deploy`; the Composer files are still generated.
|
|
168
|
+
The only Composer-specific prompt asks whether to deploy immediately. It is skipped in `--yes` runs unless you pass `--deploy`; the Composer files are still generated. Prisma Client generation is automatic, and PostgreSQL uses Prisma Postgres by default without additional prompts.
|
|
171
169
|
|
|
172
170
|
## Local Development
|
|
173
171
|
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { n as createCreatePrismaCli } from "./src-
|
|
2
|
+
import { n as createCreatePrismaCli } from "./src-8s8Pt9Xh.mjs";
|
|
3
3
|
//#region src/cli.ts
|
|
4
4
|
await createCreatePrismaCli().run({ formatError: (error) => error instanceof Error ? error.message : String(error) });
|
|
5
5
|
if (process.exitCode && process.exitCode !== 0) process.exit(process.exitCode);
|
package/dist/index.d.mts
CHANGED
|
@@ -187,10 +187,6 @@ declare const PackageManagerSchema: z.ZodEnum<{
|
|
|
187
187
|
bun: "bun";
|
|
188
188
|
deno: "deno";
|
|
189
189
|
}>;
|
|
190
|
-
declare const SchemaPresetSchema: z.ZodEnum<{
|
|
191
|
-
empty: "empty";
|
|
192
|
-
basic: "basic";
|
|
193
|
-
}>;
|
|
194
190
|
declare const CreateTemplateSchema: z.ZodEnum<{
|
|
195
191
|
hono: "hono";
|
|
196
192
|
elysia: "elysia";
|
|
@@ -220,15 +216,8 @@ declare const CreateCommandInputSchema: z.ZodObject<{
|
|
|
220
216
|
bun: "bun";
|
|
221
217
|
deno: "deno";
|
|
222
218
|
}>>;
|
|
223
|
-
prismaPostgres: z.ZodOptional<z.ZodBoolean>;
|
|
224
219
|
databaseUrl: z.ZodOptional<z.ZodString>;
|
|
225
220
|
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
|
-
}>>;
|
|
232
221
|
name: z.ZodOptional<z.ZodString>;
|
|
233
222
|
template: z.ZodOptional<z.ZodEnum<{
|
|
234
223
|
hono: "hono";
|
|
@@ -268,15 +257,8 @@ declare const router: {
|
|
|
268
257
|
bun: "bun";
|
|
269
258
|
deno: "deno";
|
|
270
259
|
}>>;
|
|
271
|
-
prismaPostgres: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
272
260
|
databaseUrl: import("zod").ZodOptional<import("zod").ZodString>;
|
|
273
261
|
install: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
274
|
-
generate: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
275
|
-
migrateAndSeed: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
276
|
-
schemaPreset: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
277
|
-
empty: "empty";
|
|
278
|
-
basic: "basic";
|
|
279
|
-
}>>;
|
|
280
262
|
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
281
263
|
template: import("zod").ZodOptional<import("zod").ZodEnum<{
|
|
282
264
|
hono: "hono";
|
|
@@ -299,4 +281,4 @@ declare const router: {
|
|
|
299
281
|
declare function createCreatePrismaCli(): import("trpc-cli").TrpcCli;
|
|
300
282
|
declare function create(input?: CreateCommandInput): Promise<void>;
|
|
301
283
|
//#endregion
|
|
302
|
-
export { type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema,
|
|
284
|
+
export { type CreateCommandInput, CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema, create, createCreatePrismaCli, router };
|
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as CreateTemplateSchema, c as PackageManagerSchema, i as CreateCommandInputSchema,
|
|
3
|
-
export { CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema,
|
|
2
|
+
import { a as CreateTemplateSchema, c as PackageManagerSchema, i as CreateCommandInputSchema, n as createCreatePrismaCli, o as DatabaseProviderSchema, r as router, s as DatabaseUrlSchema, t as create } from "./src-8s8Pt9Xh.mjs";
|
|
3
|
+
export { CreateCommandInputSchema, CreateTemplateSchema, DatabaseProviderSchema, DatabaseUrlSchema, PackageManagerSchema, create, createCreatePrismaCli, router };
|
|
@@ -4,6 +4,7 @@ import { createCli } from "trpc-cli";
|
|
|
4
4
|
import { cancel, confirm, intro, isCancel, log, multiselect, outro, select, spinner, text } from "@clack/prompts";
|
|
5
5
|
import fs from "fs-extra";
|
|
6
6
|
import path from "node:path";
|
|
7
|
+
import { isMap, parseDocument } from "yaml";
|
|
7
8
|
import Handlebars from "handlebars";
|
|
8
9
|
import { existsSync } from "node:fs";
|
|
9
10
|
import { fileURLToPath } from "node:url";
|
|
@@ -48,6 +49,7 @@ const dependencyVersionMap = {
|
|
|
48
49
|
prisma: "^7.8.0",
|
|
49
50
|
tsx: "^4.22.4"
|
|
50
51
|
};
|
|
52
|
+
const prismaPlatformCliPackage = "@prisma/cli@3.0.0-beta.29";
|
|
51
53
|
const composerTemplates = /* @__PURE__ */ new Set([
|
|
52
54
|
"hono",
|
|
53
55
|
"elysia",
|
|
@@ -55,6 +57,7 @@ const composerTemplates = /* @__PURE__ */ new Set([
|
|
|
55
57
|
"next",
|
|
56
58
|
"astro",
|
|
57
59
|
"nuxt",
|
|
60
|
+
"svelte",
|
|
58
61
|
"tanstack-start",
|
|
59
62
|
"turborepo"
|
|
60
63
|
]);
|
|
@@ -89,9 +92,10 @@ function getCreateTemplateDependencies(template, packageManager, composer = fals
|
|
|
89
92
|
"@prisma/composer",
|
|
90
93
|
"@prisma/composer-prisma-cloud",
|
|
91
94
|
"arktype",
|
|
92
|
-
"effect"
|
|
95
|
+
"effect",
|
|
96
|
+
...template === "turborepo" ? ["dotenv"] : []
|
|
93
97
|
],
|
|
94
|
-
devDependencies: template === "hono" || template === "elysia" || template === "nest" ? ["esbuild"] : []
|
|
98
|
+
devDependencies: template === "hono" || template === "elysia" || template === "nest" || template === "svelte" ? ["esbuild"] : []
|
|
95
99
|
});
|
|
96
100
|
if (template === "turborepo") targets.push({
|
|
97
101
|
packageJsonPath: "apps/api/package.json",
|
|
@@ -117,7 +121,6 @@ const packageManagers = [
|
|
|
117
121
|
"bun",
|
|
118
122
|
"deno"
|
|
119
123
|
];
|
|
120
|
-
const schemaPresets = ["empty", "basic"];
|
|
121
124
|
const createTemplates = [
|
|
122
125
|
"hono",
|
|
123
126
|
"elysia",
|
|
@@ -150,7 +153,6 @@ const prismaSkillNames = [
|
|
|
150
153
|
];
|
|
151
154
|
const DatabaseProviderSchema = z.enum(databaseProviders);
|
|
152
155
|
const PackageManagerSchema = z.enum(packageManagers);
|
|
153
|
-
const SchemaPresetSchema = z.enum(schemaPresets);
|
|
154
156
|
const CreateTemplateSchema = z.enum(createTemplates);
|
|
155
157
|
z.enum(createAddons);
|
|
156
158
|
z.enum(addonInstallScopes);
|
|
@@ -164,12 +166,8 @@ const CommonCommandOptionsSchema = z.object({
|
|
|
164
166
|
const PrismaSetupOptionsSchema = z.object({
|
|
165
167
|
provider: DatabaseProviderSchema.optional().describe("Database provider"),
|
|
166
168
|
packageManager: PackageManagerSchema.optional().describe("Package manager used for dependency installation"),
|
|
167
|
-
prismaPostgres: z.boolean().optional().describe("Use Prisma Postgres when provider is postgresql"),
|
|
168
169
|
databaseUrl: DatabaseUrlSchema.optional().describe("DATABASE_URL value"),
|
|
169
|
-
install: z.boolean().optional().describe("Install dependencies with selected package manager")
|
|
170
|
-
generate: z.boolean().optional().describe("Generate Prisma Client after scaffolding"),
|
|
171
|
-
migrateAndSeed: z.boolean().optional().describe("Run an initial migration and seed after Prisma Client generation"),
|
|
172
|
-
schemaPreset: SchemaPresetSchema.optional().describe("Schema preset to scaffold in prisma/schema.prisma")
|
|
170
|
+
install: z.boolean().optional().describe("Install dependencies with selected package manager")
|
|
173
171
|
});
|
|
174
172
|
const PrismaSetupCommandInputSchema = CommonCommandOptionsSchema.extend(PrismaSetupOptionsSchema.shape);
|
|
175
173
|
const CreateScaffoldOptionsSchema = z.object({
|
|
@@ -188,6 +186,7 @@ const COMPOSER_DEPLOYABLE_TEMPLATES = /* @__PURE__ */ new Set([
|
|
|
188
186
|
"next",
|
|
189
187
|
"astro",
|
|
190
188
|
"nuxt",
|
|
189
|
+
"svelte",
|
|
191
190
|
"tanstack-start",
|
|
192
191
|
"turborepo"
|
|
193
192
|
]);
|
|
@@ -428,10 +427,10 @@ function getPrismaCliArgs(packageManager, prismaArgs) {
|
|
|
428
427
|
]
|
|
429
428
|
};
|
|
430
429
|
if (packageManager === "bun") return {
|
|
431
|
-
command: "
|
|
430
|
+
command: "bunx",
|
|
432
431
|
args: [
|
|
433
|
-
"--
|
|
434
|
-
"
|
|
432
|
+
"--bun",
|
|
433
|
+
"prisma",
|
|
435
434
|
...prismaArgs
|
|
436
435
|
]
|
|
437
436
|
};
|
|
@@ -469,10 +468,11 @@ function getSeedCommand(packageManager) {
|
|
|
469
468
|
}
|
|
470
469
|
function getPrismaCommand(packageManager, subcommand) {
|
|
471
470
|
if (packageManager === "deno") return `deno run -A --env-file=.env npm:prisma@${dependencyVersionMap.prisma} ${subcommand}`;
|
|
472
|
-
if (packageManager === "bun") return `bun --env-file=.env ./node_modules/.bin/prisma ${subcommand}`;
|
|
473
471
|
return `prisma ${subcommand}`;
|
|
474
472
|
}
|
|
475
473
|
Handlebars.registerHelper("eq", (left, right) => left === right);
|
|
474
|
+
Handlebars.registerHelper("composerPlatformCliInvocation", (packageManager) => packageManager ? JSON.stringify(getPackageExecutionArgs(packageManager, [prismaPlatformCliPackage], { silent: true })) : "{}");
|
|
475
|
+
Handlebars.registerHelper("prismaCliInvocation", (packageManager) => packageManager ? JSON.stringify(getPrismaCliArgs(packageManager, [])) : "{}");
|
|
476
476
|
Handlebars.registerHelper("runScriptCommand", (packageManager, scriptName) => packageManager ? getRunScriptCommand(packageManager, scriptName) : "");
|
|
477
477
|
Handlebars.registerHelper("runScriptInDirectoryCommand", (packageManager, directory, scriptName) => packageManager ? getRunScriptInDirectoryCommand(packageManager, directory, scriptName) : "");
|
|
478
478
|
Handlebars.registerHelper("packageManagerManifestValue", (packageManager) => getPackageManagerManifestValue(packageManager) ?? "");
|
|
@@ -551,11 +551,11 @@ async function renderTemplateTree(opts) {
|
|
|
551
551
|
function getCreateTemplateDir(template) {
|
|
552
552
|
return resolveTemplatesDir(`templates/create/${template}`);
|
|
553
553
|
}
|
|
554
|
-
function createTemplateContext(projectName,
|
|
554
|
+
function createTemplateContext(projectName, template, provider, packageManager, composer, composerPostgres) {
|
|
555
555
|
return {
|
|
556
556
|
projectName,
|
|
557
|
+
template,
|
|
557
558
|
provider,
|
|
558
|
-
schemaPreset,
|
|
559
559
|
packageManager,
|
|
560
560
|
composer,
|
|
561
561
|
composerPostgres
|
|
@@ -604,15 +604,15 @@ function mergePnpmAllowBuilds(content) {
|
|
|
604
604
|
return `${lines.join("\n")}\n`;
|
|
605
605
|
}
|
|
606
606
|
function mergePnpmComposerOverrides(content) {
|
|
607
|
-
const
|
|
607
|
+
const document = parseDocument(content);
|
|
608
|
+
if (document.errors.length > 0) throw new Error(`Could not update pnpm-workspace.yaml: ${document.errors[0]?.message}`);
|
|
609
|
+
if (!document.has("overrides")) document.set("overrides", document.createNode({}));
|
|
610
|
+
const overrides = document.get("overrides", true);
|
|
611
|
+
if (!isMap(overrides)) throw new Error("Could not update pnpm-workspace.yaml: \"overrides\" must be a mapping.");
|
|
612
|
+
const missingOverrides = Object.entries(composerEffectOverrides).filter(([packageName]) => !overrides.has(packageName));
|
|
608
613
|
if (missingOverrides.length === 0) return content;
|
|
609
|
-
const
|
|
610
|
-
|
|
611
|
-
const lines = trimmedContent.length > 0 ? trimmedContent.split("\n") : [];
|
|
612
|
-
const overridesIndex = lines.findIndex((line) => /^overrides:\s*$/.test(line));
|
|
613
|
-
if (overridesIndex === -1) return `${trimmedContent}\n\noverrides:\n${missingLines.join("\n")}\n`;
|
|
614
|
-
lines.splice(overridesIndex + 1, 0, ...missingLines);
|
|
615
|
-
return `${lines.join("\n")}\n`;
|
|
614
|
+
for (const [packageName, version] of missingOverrides) overrides.set(packageName, version);
|
|
615
|
+
return document.toString();
|
|
616
616
|
}
|
|
617
617
|
async function ensurePnpmWorkspace(projectDir, composer) {
|
|
618
618
|
const workspacePath = path.join(projectDir, "pnpm-workspace.yaml");
|
|
@@ -627,11 +627,18 @@ async function ensurePnpmWorkspace(projectDir, composer) {
|
|
|
627
627
|
if (nextContent !== existingContent) await fs.writeFile(workspacePath, nextContent, "utf8");
|
|
628
628
|
}
|
|
629
629
|
async function scaffoldCreateTemplate(opts) {
|
|
630
|
-
const { projectDir, projectName, template, provider,
|
|
630
|
+
const { projectDir, projectName, template, provider, packageManager } = opts;
|
|
631
|
+
const templateRoot = getCreateTemplateDir(template);
|
|
632
|
+
const context = createTemplateContext(projectName, template, provider, packageManager, opts.composer === true, opts.composerPostgres === true);
|
|
631
633
|
await renderTemplateTree({
|
|
632
|
-
templateRoot
|
|
634
|
+
templateRoot,
|
|
633
635
|
outputDir: projectDir,
|
|
634
|
-
context
|
|
636
|
+
context
|
|
637
|
+
});
|
|
638
|
+
if (context.composer && context.composerPostgres) await renderTemplateFile({
|
|
639
|
+
templateFilePath: resolveTemplatesDir("templates/shared/setup-composer-postgres.mjs.hbs"),
|
|
640
|
+
outputPath: path.join(projectDir, "scripts/setup-composer-postgres.mjs"),
|
|
641
|
+
context
|
|
635
642
|
});
|
|
636
643
|
if (packageManager === "pnpm") await ensurePnpmWorkspace(projectDir, opts.composer === true);
|
|
637
644
|
}
|
|
@@ -660,16 +667,6 @@ function getPrismaScriptMap(packageManager) {
|
|
|
660
667
|
"db:seed": `${prismaCli} db seed`
|
|
661
668
|
};
|
|
662
669
|
}
|
|
663
|
-
if (packageManager === "bun") {
|
|
664
|
-
const prismaCli = "bun --env-file=.env ./node_modules/.bin/prisma";
|
|
665
|
-
return {
|
|
666
|
-
"db:generate": `${prismaCli} generate`,
|
|
667
|
-
"db:push": `${prismaCli} db push`,
|
|
668
|
-
"db:migrate": `${prismaCli} migrate dev`,
|
|
669
|
-
"db:migrate:deploy": `${prismaCli} migrate deploy`,
|
|
670
|
-
"db:seed": `${prismaCli} db seed`
|
|
671
|
-
};
|
|
672
|
-
}
|
|
673
670
|
return {
|
|
674
671
|
"db:generate": "prisma generate",
|
|
675
672
|
"db:push": "prisma db push",
|
|
@@ -858,11 +855,7 @@ function getCreateDbCommand(packageManager) {
|
|
|
858
855
|
//#endregion
|
|
859
856
|
//#region src/tasks/setup-prisma.ts
|
|
860
857
|
const DEFAULT_DATABASE_PROVIDER = "postgresql";
|
|
861
|
-
const DEFAULT_SCHEMA_PRESET$1 = "empty";
|
|
862
|
-
const DEFAULT_PRISMA_POSTGRES = true;
|
|
863
858
|
const DEFAULT_INSTALL = true;
|
|
864
|
-
const DEFAULT_GENERATE = true;
|
|
865
|
-
const DEFAULT_MIGRATE_AND_SEED = true;
|
|
866
859
|
const PRISMA_POSTGRES_MIGRATION_DELAY_MS = 2e3;
|
|
867
860
|
const requiredPrismaFileGroups = [
|
|
868
861
|
["prisma/schema.prisma", "packages/db/prisma/schema.prisma"],
|
|
@@ -969,28 +962,6 @@ async function promptForDependencyInstall(packageManager) {
|
|
|
969
962
|
}
|
|
970
963
|
return Boolean(shouldInstall);
|
|
971
964
|
}
|
|
972
|
-
async function promptForMigrateAndSeed() {
|
|
973
|
-
const shouldMigrateAndSeed = await confirm({
|
|
974
|
-
message: "Run an initial migration and seed your database now?",
|
|
975
|
-
initialValue: DEFAULT_MIGRATE_AND_SEED
|
|
976
|
-
});
|
|
977
|
-
if (isCancel(shouldMigrateAndSeed)) {
|
|
978
|
-
cancel("Operation cancelled.");
|
|
979
|
-
return;
|
|
980
|
-
}
|
|
981
|
-
return Boolean(shouldMigrateAndSeed);
|
|
982
|
-
}
|
|
983
|
-
async function promptForPrismaPostgres() {
|
|
984
|
-
const shouldUsePrismaPostgres = await confirm({
|
|
985
|
-
message: "Use Prisma Postgres and write DATABASE_URL automatically?",
|
|
986
|
-
initialValue: true
|
|
987
|
-
});
|
|
988
|
-
if (isCancel(shouldUsePrismaPostgres)) {
|
|
989
|
-
cancel("Operation cancelled.");
|
|
990
|
-
return;
|
|
991
|
-
}
|
|
992
|
-
return Boolean(shouldUsePrismaPostgres);
|
|
993
|
-
}
|
|
994
965
|
function getCommandErrorMessage(error) {
|
|
995
966
|
if (error instanceof Error && "stderr" in error) {
|
|
996
967
|
const stderr = String(error.stderr ?? "").trim();
|
|
@@ -1002,10 +973,8 @@ async function collectPrismaSetupInitialContext(input, options = {}) {
|
|
|
1002
973
|
const projectDir = path.resolve(options.projectDir ?? process.cwd());
|
|
1003
974
|
const useDefaults = input.yes === true;
|
|
1004
975
|
const verbose = input.verbose === true;
|
|
1005
|
-
const shouldGenerate = input.generate ?? DEFAULT_GENERATE;
|
|
1006
976
|
const databaseProvider = input.provider ?? (useDefaults ? DEFAULT_DATABASE_PROVIDER : await promptForDatabaseProvider());
|
|
1007
977
|
if (!databaseProvider) return;
|
|
1008
|
-
const schemaPreset = input.schemaPreset ?? options.defaultSchemaPreset ?? DEFAULT_SCHEMA_PRESET$1;
|
|
1009
978
|
const databaseUrl = input.databaseUrl;
|
|
1010
979
|
const detectedPackageManager = await detectPackageManager(projectDir);
|
|
1011
980
|
const packageManager = input.packageManager ?? (useDefaults ? detectedPackageManager : await promptForPackageManager(detectedPackageManager));
|
|
@@ -1015,29 +984,18 @@ async function collectPrismaSetupInitialContext(input, options = {}) {
|
|
|
1015
984
|
return {
|
|
1016
985
|
projectDir,
|
|
1017
986
|
verbose,
|
|
1018
|
-
shouldGenerate,
|
|
1019
987
|
databaseProvider,
|
|
1020
|
-
schemaPreset,
|
|
1021
988
|
databaseUrl,
|
|
1022
989
|
packageManager,
|
|
1023
990
|
shouldInstall
|
|
1024
991
|
};
|
|
1025
992
|
}
|
|
1026
|
-
async function completePrismaSetupContext(
|
|
1027
|
-
const
|
|
1028
|
-
let shouldUsePrismaPostgres = false;
|
|
1029
|
-
const shouldUseComputePostgres = context.databaseProvider === "postgresql" && !context.databaseUrl && options.useComputePostgres === true;
|
|
1030
|
-
if (context.databaseProvider === "postgresql" && !context.databaseUrl && !shouldUseComputePostgres) {
|
|
1031
|
-
const prismaPostgresChoice = input.prismaPostgres ?? (useDefaults ? DEFAULT_PRISMA_POSTGRES : await promptForPrismaPostgres());
|
|
1032
|
-
if (prismaPostgresChoice === void 0) return;
|
|
1033
|
-
shouldUsePrismaPostgres = prismaPostgresChoice;
|
|
1034
|
-
}
|
|
1035
|
-
const shouldMigrateAndSeed = !(context.shouldInstall && context.shouldGenerate && !(shouldUseComputePostgres && options.skipMigrateAndSeedPrompt)) ? false : input.migrateAndSeed ?? (useDefaults ? DEFAULT_MIGRATE_AND_SEED : await promptForMigrateAndSeed());
|
|
1036
|
-
if (shouldMigrateAndSeed === void 0) return;
|
|
993
|
+
async function completePrismaSetupContext(context, options = {}) {
|
|
994
|
+
const shouldUsePrismaPostgres = context.databaseProvider === "postgresql" && !context.databaseUrl;
|
|
1037
995
|
return {
|
|
1038
996
|
...context,
|
|
1039
997
|
shouldUsePrismaPostgres,
|
|
1040
|
-
shouldMigrateAndSeed
|
|
998
|
+
shouldMigrateAndSeed: options.shouldMigrateAndSeed === true
|
|
1041
999
|
};
|
|
1042
1000
|
}
|
|
1043
1001
|
function getDefaultDatabaseUrl(provider) {
|
|
@@ -1223,7 +1181,6 @@ async function finalizePrismaFilesForContext(context, projectDir, provisionResul
|
|
|
1223
1181
|
}
|
|
1224
1182
|
async function generatePrismaClientForContext(context, projectDir) {
|
|
1225
1183
|
const prismaProjectDir = await resolvePrismaProjectDir(projectDir);
|
|
1226
|
-
if (!context.shouldGenerate) return { didGenerateClient: false };
|
|
1227
1184
|
const generateCommand = getRunScriptCommand(context.packageManager, "db:generate");
|
|
1228
1185
|
if (context.verbose) log.step(`Running ${generateCommand}`);
|
|
1229
1186
|
const generateSpinner = context.verbose ? void 0 : spinner();
|
|
@@ -1257,7 +1214,7 @@ function buildNextStepsForContext(opts) {
|
|
|
1257
1214
|
const { context, options, didGenerateClient, didMigrate, didSeed } = opts;
|
|
1258
1215
|
const nextSteps = [...options.prependNextSteps ?? []];
|
|
1259
1216
|
if (!context.shouldInstall) nextSteps.push(`- ${getInstallCommand(context.packageManager)}`);
|
|
1260
|
-
if (!didGenerateClient
|
|
1217
|
+
if (!didGenerateClient) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "db:generate")}`);
|
|
1261
1218
|
if (options.includeMigrationAndSeedNextSteps !== false && !didMigrate) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "db:migrate")}`);
|
|
1262
1219
|
if (options.includeMigrationAndSeedNextSteps !== false && !didSeed) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "db:seed")}`);
|
|
1263
1220
|
if (options.includeDevNextStep) nextSteps.push(`- ${getRunScriptCommand(context.packageManager, "dev")}`);
|
|
@@ -1271,7 +1228,7 @@ async function executePrismaMigrationAndSeed(params) {
|
|
|
1271
1228
|
});
|
|
1272
1229
|
return migrateAndSeedIfRequested(params.context, params.projectDir, {
|
|
1273
1230
|
databaseUrl: params.databaseUrl,
|
|
1274
|
-
didGenerateClient:
|
|
1231
|
+
didGenerateClient: params.didGenerateClient
|
|
1275
1232
|
});
|
|
1276
1233
|
}
|
|
1277
1234
|
async function executePrismaSetupContext(context, options = {}) {
|
|
@@ -1298,6 +1255,7 @@ async function executePrismaSetupContext(context, options = {}) {
|
|
|
1298
1255
|
didSeed: migrateAndSeedResult.didSeed
|
|
1299
1256
|
}),
|
|
1300
1257
|
warningSection: warningLines.length > 0 ? `\n\n${warningLines.join("\n")}` : "",
|
|
1258
|
+
didGenerateClient: generateResult.didGenerateClient,
|
|
1301
1259
|
databaseUrl: provisionResult.databaseUrl ?? context.databaseUrl
|
|
1302
1260
|
};
|
|
1303
1261
|
}
|
|
@@ -1899,7 +1857,6 @@ async function executeCreateAddonSetupContext(params) {
|
|
|
1899
1857
|
}
|
|
1900
1858
|
//#endregion
|
|
1901
1859
|
//#region src/tasks/deploy-with-composer.ts
|
|
1902
|
-
const PRISMA_PLATFORM_CLI = "@prisma/cli@latest";
|
|
1903
1860
|
function hasEnvironmentValue(name) {
|
|
1904
1861
|
return (process.env[name] ?? "").trim().length > 0;
|
|
1905
1862
|
}
|
|
@@ -1925,7 +1882,7 @@ function createExplicitDeployError(reason, error) {
|
|
|
1925
1882
|
}
|
|
1926
1883
|
async function runPlatformCliJson(params) {
|
|
1927
1884
|
const execution = getPackageExecutionArgs(params.context.packageManager, [
|
|
1928
|
-
|
|
1885
|
+
prismaPlatformCliPackage,
|
|
1929
1886
|
...params.args,
|
|
1930
1887
|
"--json",
|
|
1931
1888
|
"--no-interactive"
|
|
@@ -1947,8 +1904,8 @@ async function runPlatformCliJson(params) {
|
|
|
1947
1904
|
}
|
|
1948
1905
|
})();
|
|
1949
1906
|
if (result.exitCode !== 0 || !parsed || !parsed.ok) {
|
|
1950
|
-
const detail = parsed && !parsed.ok ? parsed.error?.summary ?? parsed.error?.message : result.stderr || "invalid JSON output";
|
|
1951
|
-
throw new Error(getErrorMessage(detail));
|
|
1907
|
+
const detail = parsed && !parsed.ok ? parsed.error?.summary ?? parsed.error?.message ?? result.stderr : result.stderr || "invalid JSON output";
|
|
1908
|
+
throw new Error(getErrorMessage(detail || "Prisma CLI reported an unknown error"));
|
|
1952
1909
|
}
|
|
1953
1910
|
return parsed.result;
|
|
1954
1911
|
}
|
|
@@ -2014,13 +1971,15 @@ async function resolveComposerPostgresDatabaseUrl(params) {
|
|
|
2014
1971
|
return databaseUrl;
|
|
2015
1972
|
}
|
|
2016
1973
|
function getComposerDeployScriptMap(context) {
|
|
1974
|
+
const steps = [
|
|
1975
|
+
getRunScriptCommand(context.packageManager, "build"),
|
|
1976
|
+
getRunScriptCommand(context.packageManager, "composer:deploy"),
|
|
1977
|
+
...context.useComposerPostgres ? [getRunScriptCommand(context.packageManager, "composer:database:setup")] : []
|
|
1978
|
+
];
|
|
2017
1979
|
return {
|
|
2018
1980
|
"composer:deploy": "prisma-composer deploy module.ts",
|
|
2019
|
-
|
|
2020
|
-
|
|
2021
|
-
getRunScriptCommand(context.packageManager, "build"),
|
|
2022
|
-
getRunScriptCommand(context.packageManager, "composer:deploy")
|
|
2023
|
-
].join(" && ")
|
|
1981
|
+
...context.useComposerPostgres ? { "composer:database:setup": "node scripts/setup-composer-postgres.mjs" } : {},
|
|
1982
|
+
deploy: steps.join(" && ")
|
|
2024
1983
|
};
|
|
2025
1984
|
}
|
|
2026
1985
|
async function collectComposerDeployContext(input, options) {
|
|
@@ -2136,7 +2095,7 @@ async function getAnonymousId() {
|
|
|
2136
2095
|
}
|
|
2137
2096
|
function getCommonProperties() {
|
|
2138
2097
|
return {
|
|
2139
|
-
"cli-version": "0.7.1-pr.52.
|
|
2098
|
+
"cli-version": "0.7.1-pr.52.169.1",
|
|
2140
2099
|
"node-version": process.version,
|
|
2141
2100
|
platform: process.platform,
|
|
2142
2101
|
arch: process.arch
|
|
@@ -2195,10 +2154,9 @@ function getBaseCreateProperties(input, context) {
|
|
|
2195
2154
|
template: context?.template ?? input.template ?? null,
|
|
2196
2155
|
"database-provider": context?.prismaSetupContext.databaseProvider ?? input.provider ?? null,
|
|
2197
2156
|
"package-manager": context?.prismaSetupContext.packageManager ?? input.packageManager ?? null,
|
|
2198
|
-
"schema-preset": context?.prismaSetupContext.schemaPreset ?? input.schemaPreset ?? null,
|
|
2199
2157
|
"should-install": context?.prismaSetupContext.shouldInstall ?? input.install ?? null,
|
|
2200
|
-
"should-generate":
|
|
2201
|
-
"uses-prisma-postgres": context?.prismaSetupContext.shouldUsePrismaPostgres ?? input.
|
|
2158
|
+
"should-generate": true,
|
|
2159
|
+
"uses-prisma-postgres": context?.prismaSetupContext.shouldUsePrismaPostgres ?? (input.provider === "postgresql" && !input.databaseUrl ? true : null),
|
|
2202
2160
|
addons: resolvedAddons,
|
|
2203
2161
|
"addon-count": resolvedAddons.length,
|
|
2204
2162
|
"addon-scope": context?.addonSetupContext?.scope ?? null,
|
|
@@ -2245,7 +2203,6 @@ function getCreatePrismaIntro() {
|
|
|
2245
2203
|
//#region src/commands/create.ts
|
|
2246
2204
|
const DEFAULT_PROJECT_NAME = "my-app";
|
|
2247
2205
|
const DEFAULT_TEMPLATE = "hono";
|
|
2248
|
-
const DEFAULT_SCHEMA_PRESET = "basic";
|
|
2249
2206
|
function toPackageName(projectName) {
|
|
2250
2207
|
return projectName.toLowerCase().replace(/[^a-z0-9._-]/g, "-").replace(/^-+/, "").replace(/-+$/, "") || "app";
|
|
2251
2208
|
}
|
|
@@ -2406,10 +2363,7 @@ async function collectCreateContext(input) {
|
|
|
2406
2363
|
cancel(`Target directory ${formatPathForDisplay(targetDirectory)} is not empty. Use --force to continue.`);
|
|
2407
2364
|
return;
|
|
2408
2365
|
}
|
|
2409
|
-
const prismaSetupInitialContext = await collectPrismaSetupInitialContext(input, {
|
|
2410
|
-
projectDir: targetDirectory,
|
|
2411
|
-
defaultSchemaPreset: DEFAULT_SCHEMA_PRESET
|
|
2412
|
-
});
|
|
2366
|
+
const prismaSetupInitialContext = await collectPrismaSetupInitialContext(input, { projectDir: targetDirectory });
|
|
2413
2367
|
if (!prismaSetupInitialContext) return;
|
|
2414
2368
|
const projectPackageName = toPackageName(path.basename(targetDirectory));
|
|
2415
2369
|
const composerDeployContext = await collectComposerDeployContext(input, {
|
|
@@ -2419,16 +2373,17 @@ async function collectCreateContext(input) {
|
|
|
2419
2373
|
useDefaults
|
|
2420
2374
|
});
|
|
2421
2375
|
if (composerDeployContext === void 0) return;
|
|
2422
|
-
const prismaSetupContext = await completePrismaSetupContext(
|
|
2376
|
+
const prismaSetupContext = await completePrismaSetupContext(prismaSetupInitialContext, { shouldMigrateAndSeed: Boolean(composerDeployContext) });
|
|
2423
2377
|
if (!prismaSetupContext) return;
|
|
2424
|
-
const
|
|
2378
|
+
const composerEnabled = isComposerDeployableTemplate(template) && prismaSetupContext.packageManager !== "deno";
|
|
2379
|
+
const useComposerPostgres = composerEnabled && prismaSetupContext.shouldUsePrismaPostgres;
|
|
2425
2380
|
if (composerDeployContext) composerDeployContext.useComposerPostgres = useComposerPostgres;
|
|
2426
|
-
if (useComposerPostgres) log.info("
|
|
2427
|
-
const
|
|
2381
|
+
if (composerDeployContext && useComposerPostgres) log.info("Composer will provision Prisma Postgres and wire it into the application.");
|
|
2382
|
+
const composerScaffoldContext = composerEnabled ? composerDeployContext ?? {
|
|
2428
2383
|
template,
|
|
2429
2384
|
packageManager: prismaSetupContext.packageManager,
|
|
2430
2385
|
projectName: projectPackageName,
|
|
2431
|
-
useComposerPostgres
|
|
2386
|
+
useComposerPostgres
|
|
2432
2387
|
} : void 0;
|
|
2433
2388
|
const addonSetupContext = await collectCreateAddonSetupContext(input, {
|
|
2434
2389
|
useDefaults,
|
|
@@ -2445,7 +2400,7 @@ async function collectCreateContext(input) {
|
|
|
2445
2400
|
projectPackageName,
|
|
2446
2401
|
prismaSetupContext,
|
|
2447
2402
|
addonSetupContext: addonSetupContext ?? void 0,
|
|
2448
|
-
|
|
2403
|
+
composerScaffoldContext,
|
|
2449
2404
|
composerDeployContext: composerDeployContext ?? void 0,
|
|
2450
2405
|
useComposerPostgres
|
|
2451
2406
|
};
|
|
@@ -2458,10 +2413,9 @@ async function executeCreateContext(context) {
|
|
|
2458
2413
|
projectDir: context.targetDirectory,
|
|
2459
2414
|
projectName: context.projectPackageName,
|
|
2460
2415
|
template: context.template,
|
|
2461
|
-
schemaPreset: context.prismaSetupContext.schemaPreset,
|
|
2462
2416
|
provider: context.prismaSetupContext.databaseProvider,
|
|
2463
2417
|
packageManager: context.prismaSetupContext.packageManager,
|
|
2464
|
-
composer: Boolean(context.
|
|
2418
|
+
composer: Boolean(context.composerScaffoldContext),
|
|
2465
2419
|
composerPostgres: context.useComposerPostgres
|
|
2466
2420
|
});
|
|
2467
2421
|
scaffoldSpinner.stop("Project files scaffolded.");
|
|
@@ -2477,11 +2431,11 @@ async function executeCreateContext(context) {
|
|
|
2477
2431
|
await writeCreateTemplateDependencies({
|
|
2478
2432
|
template: context.template,
|
|
2479
2433
|
packageManager: context.prismaSetupContext.packageManager,
|
|
2480
|
-
composer: Boolean(context.
|
|
2434
|
+
composer: Boolean(context.composerScaffoldContext),
|
|
2481
2435
|
projectDir: context.targetDirectory
|
|
2482
2436
|
});
|
|
2483
|
-
if (context.
|
|
2484
|
-
scripts: getComposerDeployScriptMap(context.
|
|
2437
|
+
if (context.composerScaffoldContext) await addPackageDependency({
|
|
2438
|
+
scripts: getComposerDeployScriptMap(context.composerScaffoldContext),
|
|
2485
2439
|
scriptMode: "if-missing",
|
|
2486
2440
|
projectDir: context.targetDirectory
|
|
2487
2441
|
});
|
|
@@ -2510,7 +2464,8 @@ async function executeCreateContext(context) {
|
|
|
2510
2464
|
}
|
|
2511
2465
|
let prismaResult;
|
|
2512
2466
|
try {
|
|
2513
|
-
|
|
2467
|
+
const deploysComposerPostgresNow = Boolean(context.composerDeployContext && context.useComposerPostgres);
|
|
2468
|
+
prismaResult = await executePrismaSetupContext(deploysComposerPostgresNow ? {
|
|
2514
2469
|
...context.prismaSetupContext,
|
|
2515
2470
|
shouldUsePrismaPostgres: false,
|
|
2516
2471
|
shouldMigrateAndSeed: false
|
|
@@ -2518,7 +2473,7 @@ async function executeCreateContext(context) {
|
|
|
2518
2473
|
prependNextSteps: nextSteps,
|
|
2519
2474
|
projectDir: context.targetDirectory,
|
|
2520
2475
|
includeDevNextStep: true,
|
|
2521
|
-
includeMigrationAndSeedNextSteps: !
|
|
2476
|
+
includeMigrationAndSeedNextSteps: !deploysComposerPostgresNow
|
|
2522
2477
|
});
|
|
2523
2478
|
if (!prismaResult.ok) return {
|
|
2524
2479
|
ok: false,
|
|
@@ -2545,15 +2500,25 @@ async function executeCreateContext(context) {
|
|
|
2545
2500
|
if (result.ok) {
|
|
2546
2501
|
deployResult = result.result;
|
|
2547
2502
|
if (context.useComposerPostgres) {
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2503
|
+
let migration;
|
|
2504
|
+
try {
|
|
2505
|
+
const databaseUrl = await resolveComposerPostgresDatabaseUrl({
|
|
2506
|
+
context: context.composerDeployContext,
|
|
2507
|
+
projectDir: context.targetDirectory
|
|
2508
|
+
});
|
|
2509
|
+
migration = await executePrismaMigrationAndSeed({
|
|
2510
|
+
context: context.prismaSetupContext,
|
|
2511
|
+
projectDir: context.targetDirectory,
|
|
2512
|
+
databaseUrl,
|
|
2513
|
+
didGenerateClient: prismaResult.didGenerateClient
|
|
2514
|
+
});
|
|
2515
|
+
} catch (error) {
|
|
2516
|
+
migration = {
|
|
2517
|
+
didMigrate: false,
|
|
2518
|
+
didSeed: false,
|
|
2519
|
+
warning: `Could not resolve the Composer-provisioned database URL: ${error instanceof Error ? error.message : String(error)}`
|
|
2520
|
+
};
|
|
2521
|
+
}
|
|
2557
2522
|
if (migration.warning) prismaResult.warningSection += `\n\n- ${migration.warning}`;
|
|
2558
2523
|
if (!migration.didMigrate) prismaResult.nextSteps.push(`- ${getRunScriptCommand(context.prismaSetupContext.packageManager, "db:migrate")}`);
|
|
2559
2524
|
if (!migration.didSeed) prismaResult.nextSteps.push(`- ${getRunScriptCommand(context.prismaSetupContext.packageManager, "db:seed")}`);
|
|
@@ -2576,7 +2541,7 @@ async function executeCreateContext(context) {
|
|
|
2576
2541
|
}
|
|
2577
2542
|
//#endregion
|
|
2578
2543
|
//#region src/index.ts
|
|
2579
|
-
const CLI_VERSION = "0.7.1-pr.52.
|
|
2544
|
+
const CLI_VERSION = "0.7.1-pr.52.169.1";
|
|
2580
2545
|
const router = os.router({ create: os.meta({
|
|
2581
2546
|
description: "Create a new project with Prisma setup",
|
|
2582
2547
|
default: true,
|
|
@@ -2595,4 +2560,4 @@ async function create(input = {}) {
|
|
|
2595
2560
|
await runCreateCommand(input);
|
|
2596
2561
|
}
|
|
2597
2562
|
//#endregion
|
|
2598
|
-
export { CreateTemplateSchema as a, PackageManagerSchema as c, CreateCommandInputSchema as i,
|
|
2563
|
+
export { CreateTemplateSchema as a, PackageManagerSchema as c, CreateCommandInputSchema as i, createCreatePrismaCli as n, DatabaseProviderSchema as o, router as r, DatabaseUrlSchema as s, create as t };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-prisma",
|
|
3
|
-
"version": "0.7.1-pr.52.
|
|
3
|
+
"version": "0.7.1-pr.52.169.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Create Prisma 7 projects with first-party templates and great DX.",
|
|
6
6
|
"homepage": "https://github.com/prisma/create-prisma",
|
|
@@ -54,6 +54,7 @@
|
|
|
54
54
|
"handlebars": "^4.7.9",
|
|
55
55
|
"posthog-node": "^5.38.2",
|
|
56
56
|
"trpc-cli": "^0.15.1",
|
|
57
|
+
"yaml": "^2.8.2",
|
|
57
58
|
"zod": "^4.4.3"
|
|
58
59
|
},
|
|
59
60
|
"devDependencies": {
|