create-prisma 0.11.0 → 0.11.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 +1 -1
- package/dist/cli.mjs +1 -1
- package/dist/{create-DX_T1T1y.mjs → create-CT9uJcQ1.mjs} +43 -9
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ yarn dlx create-prisma@latest my-app
|
|
|
13
13
|
bunx create-prisma@latest my-app
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
-
The CLI initializes Prisma 8 with `prisma@
|
|
16
|
+
The CLI initializes Prisma 8 with `prisma@latest`, installs dependencies, emits the contract, and generates a deployable Composer app. PostgreSQL projects use Composer's native Prisma Postgres provider, including migrations and a typed runtime client.
|
|
17
17
|
|
|
18
18
|
The deployment prompt is:
|
|
19
19
|
|
package/dist/cli.mjs
CHANGED
|
@@ -88,7 +88,7 @@ async function getAnonymousId() {
|
|
|
88
88
|
}
|
|
89
89
|
function getCommonProperties() {
|
|
90
90
|
return {
|
|
91
|
-
"cli-version": "0.11.
|
|
91
|
+
"cli-version": "0.11.1",
|
|
92
92
|
"node-version": process.version,
|
|
93
93
|
platform: process.platform,
|
|
94
94
|
arch: process.arch
|
|
@@ -129,6 +129,21 @@ async function trackCliTelemetry(event, properties) {
|
|
|
129
129
|
const CREATE_PRISMA_NEXT_COMPLETED_EVENT = "cli:create_prisma_next_command_completed";
|
|
130
130
|
const CREATE_PRISMA_NEXT_FAILED_EVENT = "cli:create_prisma_next_command_failed";
|
|
131
131
|
const CREATE_PRISMA_NEXT_CANCELLED_EVENT = "cli:create_prisma_next_command_cancelled";
|
|
132
|
+
const expectedRejectionReasons = new Set([
|
|
133
|
+
"invalid_input",
|
|
134
|
+
"unsupported_node_version",
|
|
135
|
+
"invalid_project_name",
|
|
136
|
+
"target_path_not_directory",
|
|
137
|
+
"target_directory_not_empty",
|
|
138
|
+
"unsupported_configuration",
|
|
139
|
+
"not_authenticated",
|
|
140
|
+
"workspace_missing",
|
|
141
|
+
"workspace_mismatch",
|
|
142
|
+
"project_name_collision"
|
|
143
|
+
]);
|
|
144
|
+
function getFailureClass(reason) {
|
|
145
|
+
return expectedRejectionReasons.has(reason) ? "expected_rejection" : "technical_failure";
|
|
146
|
+
}
|
|
132
147
|
function getTargetDirectoryState(context) {
|
|
133
148
|
if (!context.targetPathState.exists) return "new";
|
|
134
149
|
if (context.targetPathState.isEmptyDirectory) return "empty_directory";
|
|
@@ -161,6 +176,11 @@ function getErrorCode(error) {
|
|
|
161
176
|
const code = Reflect.get(error, "code");
|
|
162
177
|
return typeof code === "number" || typeof code === "string" ? code : null;
|
|
163
178
|
}
|
|
179
|
+
function getPrismaCliFailureProperty(error, property) {
|
|
180
|
+
if (typeof error !== "object" || error === null) return null;
|
|
181
|
+
const value = Reflect.get(error, property);
|
|
182
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
183
|
+
}
|
|
164
184
|
async function trackCreateCompleted(params) {
|
|
165
185
|
await trackCliTelemetry(CREATE_PRISMA_NEXT_COMPLETED_EVENT, {
|
|
166
186
|
...getBaseCreateProperties(params.input, params.context),
|
|
@@ -171,10 +191,13 @@ async function trackCreateFailed(params) {
|
|
|
171
191
|
await trackCliTelemetry(CREATE_PRISMA_NEXT_FAILED_EVENT, {
|
|
172
192
|
...getBaseCreateProperties(params.input, params.context),
|
|
173
193
|
"duration-ms": params.durationMs,
|
|
194
|
+
"failure-class": getFailureClass(params.reason),
|
|
174
195
|
"failure-stage": params.stage,
|
|
175
196
|
"failure-reason": params.reason,
|
|
176
197
|
"error-name": getErrorName(params.error),
|
|
177
|
-
"error-code": getErrorCode(params.error)
|
|
198
|
+
"error-code": getErrorCode(params.error),
|
|
199
|
+
"prisma-cli-command": getPrismaCliFailureProperty(params.error, "prismaCliCommand"),
|
|
200
|
+
"prisma-cli-error-code": getPrismaCliFailureProperty(params.error, "prismaCliErrorCode")
|
|
178
201
|
});
|
|
179
202
|
}
|
|
180
203
|
async function trackCreateCancelled(params) {
|
|
@@ -546,12 +569,12 @@ const dependencyVersionMap = {
|
|
|
546
569
|
mongodb: "^7.1.0",
|
|
547
570
|
"mongodb-memory-server": "^11.1.0",
|
|
548
571
|
nitro: "^3.0.260610-beta",
|
|
549
|
-
prisma: "
|
|
572
|
+
prisma: "latest",
|
|
550
573
|
"temporal-polyfill": "^1.0.4",
|
|
551
574
|
tsx: "^4.21.0",
|
|
552
575
|
typescript: "^5.9.3"
|
|
553
576
|
};
|
|
554
|
-
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@
|
|
577
|
+
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@latest";
|
|
555
578
|
const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
|
|
556
579
|
function getDependencyVersion(packageName) {
|
|
557
580
|
return dependencyVersionMap[packageName];
|
|
@@ -768,6 +791,16 @@ function getErrorMessage(error) {
|
|
|
768
791
|
|
|
769
792
|
//#endregion
|
|
770
793
|
//#region src/tasks/deploy-with-composer.ts
|
|
794
|
+
var PrismaCliCommandError = class extends Error {
|
|
795
|
+
prismaCliCommand;
|
|
796
|
+
prismaCliErrorCode;
|
|
797
|
+
constructor(options) {
|
|
798
|
+
super(options.message);
|
|
799
|
+
this.name = "PrismaCliCommandError";
|
|
800
|
+
this.prismaCliCommand = options.command;
|
|
801
|
+
this.prismaCliErrorCode = options.code;
|
|
802
|
+
}
|
|
803
|
+
};
|
|
771
804
|
function stripResourcePrefix(id, prefix) {
|
|
772
805
|
const marker = `${prefix}_`;
|
|
773
806
|
return id.startsWith(marker) ? id.slice(marker.length) : id;
|
|
@@ -814,10 +847,11 @@ async function runPrismaJsonCommand(options) {
|
|
|
814
847
|
if (result.exitCode !== 0 && result.stderr.trim()) throw new Error(result.stderr.trim());
|
|
815
848
|
throw error;
|
|
816
849
|
}
|
|
817
|
-
if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
850
|
+
if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) throw new PrismaCliCommandError({
|
|
851
|
+
message: [envelope.error?.summary ?? envelope.error?.message, envelope.error?.why].filter(Boolean).join(": ") || result.stderr.trim() || "Prisma CLI command failed.",
|
|
852
|
+
...envelope.commandId || envelope.command ? { command: envelope.commandId ?? envelope.command } : {},
|
|
853
|
+
...envelope.error?.code ? { code: envelope.error.code } : {}
|
|
854
|
+
});
|
|
821
855
|
return envelope.result;
|
|
822
856
|
}
|
|
823
857
|
function findProjectNameCollisions(projects, appName) {
|
|
@@ -1579,7 +1613,7 @@ function supportsPrisma(nodeVersion = process.versions.node) {
|
|
|
1579
1613
|
}
|
|
1580
1614
|
function getUnsupportedNodeMessage(nodeVersion = process.versions.node) {
|
|
1581
1615
|
return [
|
|
1582
|
-
`Node.js ${nodeVersion} is unsupported by create-prisma@
|
|
1616
|
+
`Node.js ${nodeVersion} is unsupported by create-prisma@latest.`,
|
|
1583
1617
|
"Required: Node.js 22.18 or newer.",
|
|
1584
1618
|
"Update Node.js and run the command again."
|
|
1585
1619
|
].join("\n");
|
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, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as runCreateCommand } from "./create-
|
|
2
|
+
import { a as DatabaseProviderSchema, i as CreateTemplateSchema, n as AuthoringStyleSchema, o as PackageManagerSchema, r as CreateCommandInputSchema, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as runCreateCommand } from "./create-CT9uJcQ1.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.11.
|
|
8
|
+
const CLI_VERSION = "0.11.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;
|