create-prisma 0.11.0 → 0.11.1-pr.82.289.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
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.82.289.1",
|
|
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,18 +560,19 @@ 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",
|
|
565
|
+
tsdown: "^0.22.14",
|
|
551
566
|
tsx: "^4.21.0",
|
|
552
567
|
typescript: "^5.9.3"
|
|
553
568
|
};
|
|
554
|
-
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@
|
|
569
|
+
const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@latest";
|
|
555
570
|
const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
|
|
556
571
|
function getDependencyVersion(packageName) {
|
|
557
572
|
return dependencyVersionMap[packageName];
|
|
558
573
|
}
|
|
559
574
|
function usesEsbuild(template) {
|
|
560
|
-
return template === "minimal" || template === "hono" || template === "elysia"
|
|
575
|
+
return template === "minimal" || template === "hono" || template === "elysia";
|
|
561
576
|
}
|
|
562
577
|
function getCreateTemplateDependencies(template, _packageManager) {
|
|
563
578
|
const dependencies = [
|
|
@@ -567,7 +582,8 @@ function getCreateTemplateDependencies(template, _packageManager) {
|
|
|
567
582
|
];
|
|
568
583
|
const devDependencies = [];
|
|
569
584
|
if (usesEsbuild(template)) devDependencies.push("esbuild");
|
|
570
|
-
if (template === "
|
|
585
|
+
if (template === "nest") devDependencies.push("tsdown");
|
|
586
|
+
if (template === "minimal" || template === "nest" || usesEsbuild(template)) devDependencies.push("tsx");
|
|
571
587
|
if (template === "minimal") devDependencies.push("typescript");
|
|
572
588
|
if (template === "elysia") {
|
|
573
589
|
dependencies.push("@elysiajs/node");
|
|
@@ -768,6 +784,16 @@ function getErrorMessage(error) {
|
|
|
768
784
|
|
|
769
785
|
//#endregion
|
|
770
786
|
//#region src/tasks/deploy-with-composer.ts
|
|
787
|
+
var PrismaCliCommandError = class extends Error {
|
|
788
|
+
prismaCliCommand;
|
|
789
|
+
prismaCliErrorCode;
|
|
790
|
+
constructor(options) {
|
|
791
|
+
super(options.message);
|
|
792
|
+
this.name = "PrismaCliCommandError";
|
|
793
|
+
this.prismaCliCommand = options.command;
|
|
794
|
+
this.prismaCliErrorCode = options.code;
|
|
795
|
+
}
|
|
796
|
+
};
|
|
771
797
|
function stripResourcePrefix(id, prefix) {
|
|
772
798
|
const marker = `${prefix}_`;
|
|
773
799
|
return id.startsWith(marker) ? id.slice(marker.length) : id;
|
|
@@ -814,10 +840,11 @@ async function runPrismaJsonCommand(options) {
|
|
|
814
840
|
if (result.exitCode !== 0 && result.stderr.trim()) throw new Error(result.stderr.trim());
|
|
815
841
|
throw error;
|
|
816
842
|
}
|
|
817
|
-
if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) {
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
843
|
+
if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) throw new PrismaCliCommandError({
|
|
844
|
+
message: [envelope.error?.summary ?? envelope.error?.message, envelope.error?.why].filter(Boolean).join(": ") || result.stderr.trim() || "Prisma CLI command failed.",
|
|
845
|
+
...envelope.commandId || envelope.command ? { command: envelope.commandId ?? envelope.command } : {},
|
|
846
|
+
...envelope.error?.code ? { code: envelope.error.code } : {}
|
|
847
|
+
});
|
|
821
848
|
return envelope.result;
|
|
822
849
|
}
|
|
823
850
|
function findProjectNameCollisions(projects, appName) {
|
|
@@ -1579,7 +1606,7 @@ function supportsPrisma(nodeVersion = process.versions.node) {
|
|
|
1579
1606
|
}
|
|
1580
1607
|
function getUnsupportedNodeMessage(nodeVersion = process.versions.node) {
|
|
1581
1608
|
return [
|
|
1582
|
-
`Node.js ${nodeVersion} is unsupported by create-prisma@
|
|
1609
|
+
`Node.js ${nodeVersion} is unsupported by create-prisma@latest.`,
|
|
1583
1610
|
"Required: Node.js 22.18 or newer.",
|
|
1584
1611
|
"Update Node.js and run the command again."
|
|
1585
1612
|
].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-BcWCQSRR.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.82.289.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
|
@@ -5,9 +5,12 @@
|
|
|
5
5
|
"packageManager": "{{packageManagerManifestValue packageManager}}",
|
|
6
6
|
{{/if}}
|
|
7
7
|
"type": "module",
|
|
8
|
+
"engines": {
|
|
9
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
10
|
+
},
|
|
8
11
|
"scripts": {
|
|
9
12
|
"dev": "{{runtimeScript packageManager "dev" "src/main.ts" "dist/main.js"}}",
|
|
10
|
-
"build": "
|
|
13
|
+
"build": "tsdown",
|
|
11
14
|
"start": "node dist/server.mjs"
|
|
12
15
|
},
|
|
13
16
|
"dependencies": {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { isBuiltin } from "node:module";
|
|
2
|
+
import { defineConfig } from "tsdown";
|
|
3
|
+
|
|
4
|
+
const optionalNestDependencies = [
|
|
5
|
+
/^@nestjs\/microservices(?:\/|$)/,
|
|
6
|
+
/^@nestjs\/platform-socket\.io(?:\/|$)/,
|
|
7
|
+
/^@nestjs\/websockets(?:\/|$)/,
|
|
8
|
+
/^class-transformer(?:\/|$)/,
|
|
9
|
+
/^class-validator(?:\/|$)/,
|
|
10
|
+
];
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
entry: { server: "src/main.ts" },
|
|
14
|
+
platform: "node",
|
|
15
|
+
target: "node22.18",
|
|
16
|
+
format: "esm",
|
|
17
|
+
clean: true,
|
|
18
|
+
hash: false,
|
|
19
|
+
banner:
|
|
20
|
+
"import { createRequire } from 'node:module'; const require = createRequire(import.meta.url);",
|
|
21
|
+
deps: {
|
|
22
|
+
alwaysBundle: (id) =>
|
|
23
|
+
!isBuiltin(id) && !optionalNestDependencies.some((pattern) => pattern.test(id)),
|
|
24
|
+
neverBundle: optionalNestDependencies,
|
|
25
|
+
},
|
|
26
|
+
});
|