create-prisma 0.11.0 → 0.11.1-pr.81.282.2
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-B3ckZI8O.mjs} +45 -20
- 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
|
@@ -52,21 +52,12 @@ function createCommandFailureResult(stage, message, project) {
|
|
|
52
52
|
|
|
53
53
|
//#endregion
|
|
54
54
|
//#region src/telemetry/client.ts
|
|
55
|
-
const TELEMETRY_API_KEY = "
|
|
55
|
+
const TELEMETRY_API_KEY = "";
|
|
56
56
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
57
57
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
58
58
|
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;
|
|
59
|
-
function isTruthyEnvValue(value) {
|
|
60
|
-
return [
|
|
61
|
-
"1",
|
|
62
|
-
"true",
|
|
63
|
-
"yes",
|
|
64
|
-
"on"
|
|
65
|
-
].includes(String(value ?? "").trim().toLowerCase());
|
|
66
|
-
}
|
|
67
59
|
function shouldDisableTelemetry() {
|
|
68
|
-
|
|
69
|
-
return process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
|
|
60
|
+
return true;
|
|
70
61
|
}
|
|
71
62
|
function getTelemetryConfigDir() {
|
|
72
63
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -88,7 +79,7 @@ async function getAnonymousId() {
|
|
|
88
79
|
}
|
|
89
80
|
function getCommonProperties() {
|
|
90
81
|
return {
|
|
91
|
-
"cli-version": "0.11.
|
|
82
|
+
"cli-version": "0.11.1-pr.81.282.2",
|
|
92
83
|
"node-version": process.version,
|
|
93
84
|
platform: process.platform,
|
|
94
85
|
arch: process.arch
|
|
@@ -129,6 +120,21 @@ async function trackCliTelemetry(event, properties) {
|
|
|
129
120
|
const CREATE_PRISMA_NEXT_COMPLETED_EVENT = "cli:create_prisma_next_command_completed";
|
|
130
121
|
const CREATE_PRISMA_NEXT_FAILED_EVENT = "cli:create_prisma_next_command_failed";
|
|
131
122
|
const CREATE_PRISMA_NEXT_CANCELLED_EVENT = "cli:create_prisma_next_command_cancelled";
|
|
123
|
+
const expectedRejectionReasons = new Set([
|
|
124
|
+
"invalid_input",
|
|
125
|
+
"unsupported_node_version",
|
|
126
|
+
"invalid_project_name",
|
|
127
|
+
"target_path_not_directory",
|
|
128
|
+
"target_directory_not_empty",
|
|
129
|
+
"unsupported_configuration",
|
|
130
|
+
"not_authenticated",
|
|
131
|
+
"workspace_missing",
|
|
132
|
+
"workspace_mismatch",
|
|
133
|
+
"project_name_collision"
|
|
134
|
+
]);
|
|
135
|
+
function getFailureClass(reason) {
|
|
136
|
+
return expectedRejectionReasons.has(reason) ? "expected_rejection" : "technical_failure";
|
|
137
|
+
}
|
|
132
138
|
function getTargetDirectoryState(context) {
|
|
133
139
|
if (!context.targetPathState.exists) return "new";
|
|
134
140
|
if (context.targetPathState.isEmptyDirectory) return "empty_directory";
|
|
@@ -161,6 +167,11 @@ function getErrorCode(error) {
|
|
|
161
167
|
const code = Reflect.get(error, "code");
|
|
162
168
|
return typeof code === "number" || typeof code === "string" ? code : null;
|
|
163
169
|
}
|
|
170
|
+
function getPrismaCliFailureProperty(error, property) {
|
|
171
|
+
if (typeof error !== "object" || error === null) return null;
|
|
172
|
+
const value = Reflect.get(error, property);
|
|
173
|
+
return typeof value === "string" && value.length > 0 ? value : null;
|
|
174
|
+
}
|
|
164
175
|
async function trackCreateCompleted(params) {
|
|
165
176
|
await trackCliTelemetry(CREATE_PRISMA_NEXT_COMPLETED_EVENT, {
|
|
166
177
|
...getBaseCreateProperties(params.input, params.context),
|
|
@@ -171,10 +182,13 @@ async function trackCreateFailed(params) {
|
|
|
171
182
|
await trackCliTelemetry(CREATE_PRISMA_NEXT_FAILED_EVENT, {
|
|
172
183
|
...getBaseCreateProperties(params.input, params.context),
|
|
173
184
|
"duration-ms": params.durationMs,
|
|
185
|
+
"failure-class": getFailureClass(params.reason),
|
|
174
186
|
"failure-stage": params.stage,
|
|
175
187
|
"failure-reason": params.reason,
|
|
176
188
|
"error-name": getErrorName(params.error),
|
|
177
|
-
"error-code": getErrorCode(params.error)
|
|
189
|
+
"error-code": getErrorCode(params.error),
|
|
190
|
+
"prisma-cli-command": getPrismaCliFailureProperty(params.error, "prismaCliCommand"),
|
|
191
|
+
"prisma-cli-error-code": getPrismaCliFailureProperty(params.error, "prismaCliErrorCode")
|
|
178
192
|
});
|
|
179
193
|
}
|
|
180
194
|
async function trackCreateCancelled(params) {
|
|
@@ -546,12 +560,12 @@ const dependencyVersionMap = {
|
|
|
546
560
|
mongodb: "^7.1.0",
|
|
547
561
|
"mongodb-memory-server": "^11.1.0",
|
|
548
562
|
nitro: "^3.0.260610-beta",
|
|
549
|
-
prisma: "
|
|
563
|
+
prisma: "latest",
|
|
550
564
|
"temporal-polyfill": "^1.0.4",
|
|
551
565
|
tsx: "^4.21.0",
|
|
552
566
|
typescript: "^5.9.3"
|
|
553
567
|
};
|
|
554
|
-
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@
|
|
568
|
+
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@latest";
|
|
555
569
|
const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
|
|
556
570
|
function getDependencyVersion(packageName) {
|
|
557
571
|
return dependencyVersionMap[packageName];
|
|
@@ -768,6 +782,16 @@ function getErrorMessage(error) {
|
|
|
768
782
|
|
|
769
783
|
//#endregion
|
|
770
784
|
//#region src/tasks/deploy-with-composer.ts
|
|
785
|
+
var PrismaCliCommandError = class extends Error {
|
|
786
|
+
prismaCliCommand;
|
|
787
|
+
prismaCliErrorCode;
|
|
788
|
+
constructor(options) {
|
|
789
|
+
super(options.message);
|
|
790
|
+
this.name = "PrismaCliCommandError";
|
|
791
|
+
this.prismaCliCommand = options.command;
|
|
792
|
+
this.prismaCliErrorCode = options.code;
|
|
793
|
+
}
|
|
794
|
+
};
|
|
771
795
|
function stripResourcePrefix(id, prefix) {
|
|
772
796
|
const marker = `${prefix}_`;
|
|
773
797
|
return id.startsWith(marker) ? id.slice(marker.length) : id;
|
|
@@ -814,10 +838,11 @@ async function runPrismaJsonCommand(options) {
|
|
|
814
838
|
if (result.exitCode !== 0 && result.stderr.trim()) throw new Error(result.stderr.trim());
|
|
815
839
|
throw error;
|
|
816
840
|
}
|
|
817
|
-
if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
841
|
+
if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) throw new PrismaCliCommandError({
|
|
842
|
+
message: [envelope.error?.summary ?? envelope.error?.message, envelope.error?.why].filter(Boolean).join(": ") || result.stderr.trim() || "Prisma CLI command failed.",
|
|
843
|
+
...envelope.commandId || envelope.command ? { command: envelope.commandId ?? envelope.command } : {},
|
|
844
|
+
...envelope.error?.code ? { code: envelope.error.code } : {}
|
|
845
|
+
});
|
|
821
846
|
return envelope.result;
|
|
822
847
|
}
|
|
823
848
|
function findProjectNameCollisions(projects, appName) {
|
|
@@ -1579,7 +1604,7 @@ function supportsPrisma(nodeVersion = process.versions.node) {
|
|
|
1579
1604
|
}
|
|
1580
1605
|
function getUnsupportedNodeMessage(nodeVersion = process.versions.node) {
|
|
1581
1606
|
return [
|
|
1582
|
-
`Node.js ${nodeVersion} is unsupported by create-prisma@
|
|
1607
|
+
`Node.js ${nodeVersion} is unsupported by create-prisma@latest.`,
|
|
1583
1608
|
"Required: Node.js 22.18 or newer.",
|
|
1584
1609
|
"Update Node.js and run the command again."
|
|
1585
1610
|
].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-B3ckZI8O.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-pr.81.282.2";
|
|
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