create-prisma 0.12.0 → 0.12.1-pr.85.342.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
@@ -15,6 +15,11 @@ bunx create-prisma@latest my-app
15
15
 
16
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
+ For npm, use 11.6.0 or newer, which includes the [upstream resolver fix](https://github.com/npm/cli/pull/8448).
19
+ Older npm releases can crash resolving the dependency tree (`Cannot read properties of null (reading 'edgesOut')`). Run
20
+ `npm install --global npm@11` to update. create-prisma checks the selected npm
21
+ version before writing project files and never upgrades your package manager automatically.
22
+
18
23
  The deployment prompt is:
19
24
 
20
25
  ```text
@@ -23,6 +28,11 @@ Deploy to Prisma now?
23
28
 
24
29
  Choose no to deploy later with the generated `deploy` script.
25
30
 
31
+ New apps explicitly use `us-east-1` in `prisma-composer.config.ts`. Change the
32
+ `prismaCloud({ region })` option before deploying if you need another region.
33
+ Composer requires a region when creating a new project; leaving it unspecified
34
+ only works when deploying into an existing project whose region can be inherited.
35
+
26
36
  When multiple Prisma workspace sessions are available, the CLI asks which workspace should receive
27
37
  the deployment. For unattended usage, pass `--workspace <id-or-name>` or omit it to use the active
28
38
  workspace. Choosing another workspace also updates the Prisma CLI's active workspace session.
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as ApplicationLayer } from "./json-output-CH9M3gTl.mjs";
2
+ import { a as ApplicationLayer } from "./json-output-CTzh3AGR.mjs";
3
3
  import { runCreatePrismaCli } from "./index.mjs";
4
4
  import { Effect } from "effect";
5
5
  import { NodeRuntime } from "@effect/platform-node-shared";
package/dist/index.d.mts CHANGED
@@ -4,6 +4,10 @@ import { Command } from "effect/unstable/cli";
4
4
  import * as effect_FileSystem0 from "effect/FileSystem";
5
5
  import * as effect_Cause0 from "effect/Cause";
6
6
 
7
+ //#region src/utils/child-process-failure.d.ts
8
+ declare const ChildProcessFailureSchema: Schema.Literals<readonly ["cancelled", "command_not_found", "interrupted", "max_buffer", "non_zero_exit", "permission_denied", "spawn_failed", "terminated", "timed_out"]>;
9
+ type ChildProcessFailure = typeof ChildProcessFailureSchema.Type;
10
+ //#endregion
7
11
  //#region src/services/command-runner.d.ts
8
12
  type CommandSpec = {
9
13
  command: string;
@@ -17,6 +21,7 @@ type CommandResult = {
17
21
  exitCode: number;
18
22
  stdout: string;
19
23
  stderr: string;
24
+ childProcessFailure?: ChildProcessFailure;
20
25
  };
21
26
  declare const CommandExecutionError_base: Schema.Class<CommandExecutionError, Schema.TaggedStruct<"CommandExecutionError", {
22
27
  readonly command: Schema.String;
@@ -25,6 +30,7 @@ declare const CommandExecutionError_base: Schema.Class<CommandExecutionError, Sc
25
30
  readonly stdout: Schema.String;
26
31
  readonly stderr: Schema.String;
27
32
  readonly cause: Schema.optionalKey<Schema.Defect>;
33
+ readonly childProcessFailure: Schema.optional<Schema.Literals<readonly ["cancelled", "command_not_found", "interrupted", "max_buffer", "non_zero_exit", "permission_denied", "spawn_failed", "terminated", "timed_out"]>>;
28
34
  }>, effect_Cause0.YieldableError>;
29
35
  declare class CommandExecutionError extends CommandExecutionError_base {
30
36
  get message(): string;
package/dist/index.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { _ as authoringStyles, b as normalizeDatabaseProvider, c as CreateCommandResultSchema, d as AuthoringStyleSchema, f as CreateCommandInputSchema, g as agentSkillTargets, h as PackageManagerSchema, i as getErrorMessage, l as createCommandFailureResult, m as DatabaseProviderSchema, n as writeJsonResult, o as applicationRuntime, p as CreateTemplateSchema, r as runCreateCommandEffect, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as isJsonOutputRequested, u as AgentSkillTargetSchema, v as createTemplates, x as packageManagers, y as databaseProviderInputs } from "./json-output-CH9M3gTl.mjs";
2
+ import { _ as authoringStyles, b as normalizeDatabaseProvider, c as CreateCommandResultSchema, d as AuthoringStyleSchema, f as CreateCommandInputSchema, g as agentSkillTargets, h as PackageManagerSchema, i as getErrorMessage, l as createCommandFailureResult, m as DatabaseProviderSchema, n as writeJsonResult, o as applicationRuntime, p as CreateTemplateSchema, r as runCreateCommandEffect, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as isJsonOutputRequested, u as AgentSkillTargetSchema, v as createTemplates, x as packageManagers, y as databaseProviderInputs } from "./json-output-CTzh3AGR.mjs";
3
3
  import { Console, Effect, Option } from "effect";
4
4
  import { Argument, CliError, Command, Flag } from "effect/unstable/cli";
5
5
 
6
6
  //#region src/index.ts
7
- const CLI_VERSION = "0.12.0";
7
+ const CLI_VERSION = "0.12.1-pr.85.342.1";
8
8
  const optionalArgument = (name, description) => Argument.string(name).pipe(Argument.withDescription(description), Argument.optional, Argument.map(Option.getOrUndefined));
9
9
  const optionalBoolean = (name, description) => Flag.boolean(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
10
10
  const optionalString = (name, description) => Flag.string(name).pipe(Flag.withDescription(description), Flag.optional, Flag.map(Option.getOrUndefined));
@@ -13,6 +13,36 @@ import { fileURLToPath } from "node:url";
13
13
  import { Writable } from "node:stream";
14
14
  import { styleText } from "node:util";
15
15
 
16
+ //#region src/utils/child-process-failure.ts
17
+ const ChildProcessFailureSchema = Schema.Literals([
18
+ "cancelled",
19
+ "command_not_found",
20
+ "interrupted",
21
+ "max_buffer",
22
+ "non_zero_exit",
23
+ "permission_denied",
24
+ "spawn_failed",
25
+ "terminated",
26
+ "timed_out"
27
+ ]);
28
+ const WINDOWS_CONTROL_C_EXIT_CODE = 3221225786;
29
+ function getChildProcessFailure(error) {
30
+ if (typeof error !== "object" || error === null) return void 0;
31
+ if (Reflect.get(error, "name") !== "ExecaError" || Reflect.get(error, "failed") !== true) return;
32
+ if (Reflect.get(error, "timedOut") === true) return "timed_out";
33
+ if (Reflect.get(error, "isCanceled") === true) return "cancelled";
34
+ if (Reflect.get(error, "isMaxBuffer") === true) return "max_buffer";
35
+ const exitCode = Reflect.get(error, "exitCode");
36
+ if (Reflect.get(error, "signal") === "SIGINT" || exitCode === 130 || exitCode === WINDOWS_CONTROL_C_EXIT_CODE) return "interrupted";
37
+ if (Reflect.get(error, "isTerminated") === true) return "terminated";
38
+ const code = Reflect.get(error, "code");
39
+ if (code === "ENOENT") return "command_not_found";
40
+ if (code === "EACCES" || code === "EPERM") return "permission_denied";
41
+ if (typeof exitCode === "number") return "non_zero_exit";
42
+ return "spawn_failed";
43
+ }
44
+
45
+ //#endregion
16
46
  //#region src/create-outcome.ts
17
47
  const CreateFailureStageSchema = Schema.Literals([
18
48
  "validate_input",
@@ -35,6 +65,7 @@ const CreateFailureStageSchema = Schema.Literals([
35
65
  const CreateFailureReasonSchema = Schema.Literals([
36
66
  "invalid_input",
37
67
  "unsupported_node_version",
68
+ "unsupported_package_manager_version",
38
69
  "invalid_project_name",
39
70
  "target_path_not_directory",
40
71
  "target_directory_not_empty",
@@ -93,7 +124,8 @@ var PrismaCliCommandError = class extends Schema.TaggedError()("PrismaCliCommand
93
124
  command: Schema.optionalKey(Schema.String),
94
125
  code: Schema.optionalKey(Schema.String),
95
126
  stderr: Schema.optionalKey(Schema.String),
96
- exitCode: Schema.optionalKey(Schema.Number)
127
+ exitCode: Schema.optionalKey(Schema.Number),
128
+ childProcessFailure: Schema.optional(ChildProcessFailureSchema)
97
129
  }) {
98
130
  prismaCliCommand = this.command;
99
131
  prismaCliErrorCode = this.code;
@@ -282,7 +314,8 @@ var CommandExecutionError = class extends Schema.TaggedError()("CommandExecution
282
314
  exitCode: Schema.optionalKey(Schema.Number),
283
315
  stdout: Schema.String,
284
316
  stderr: Schema.String,
285
- cause: Schema.optionalKey(Schema.Defect())
317
+ cause: Schema.optionalKey(Schema.Defect()),
318
+ childProcessFailure: Schema.optional(ChildProcessFailureSchema)
286
319
  }) {
287
320
  get message() {
288
321
  const detail = this.stderr.trim() || this.stdout.trim();
@@ -318,7 +351,8 @@ var CommandRunner = class CommandRunner extends Context.Service()("create-prisma
318
351
  return {
319
352
  exitCode: result.exitCode ?? 1,
320
353
  stdout: typeof result.stdout === "string" ? result.stdout : "",
321
- stderr: typeof result.stderr === "string" ? result.stderr : ""
354
+ stderr: typeof result.stderr === "string" ? result.stderr : "",
355
+ childProcessFailure: getChildProcessFailure(result)
322
356
  };
323
357
  },
324
358
  catch: (cause) => new CommandExecutionError({
@@ -326,7 +360,8 @@ var CommandRunner = class CommandRunner extends Context.Service()("create-prisma
326
360
  args: [...spec.args],
327
361
  stdout: "",
328
362
  stderr: "",
329
- cause
363
+ cause,
364
+ childProcessFailure: getChildProcessFailure(cause)
330
365
  })
331
366
  }));
332
367
  const runChecked = Effect.fn("CommandRunner.runChecked")((spec) => Effect.flatMap(run(spec), (result) => result.exitCode === 0 ? Effect.succeed(result) : Effect.fail(new CommandExecutionError({
@@ -334,7 +369,8 @@ var CommandRunner = class CommandRunner extends Context.Service()("create-prisma
334
369
  args: [...spec.args],
335
370
  exitCode: result.exitCode,
336
371
  stdout: result.stdout,
337
- stderr: result.stderr
372
+ stderr: result.stderr,
373
+ childProcessFailure: result.childProcessFailure
338
374
  }))));
339
375
  return CommandRunner.of({
340
376
  run,
@@ -351,20 +387,14 @@ const applicationRuntime = ManagedRuntime.make(ApplicationLayer);
351
387
 
352
388
  //#endregion
353
389
  //#region src/telemetry/client.ts
354
- const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
390
+ const TELEMETRY_API_KEY = "";
355
391
  const TELEMETRY_HOST = "https://us.i.posthog.com";
356
392
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
357
393
  const TELEMETRY_TIMEOUT_MS = 2e3;
358
394
  const AnonymousId = Schema.String.check(Schema.isUUID(4));
359
395
  const decodeAnonymousId = Schema.decodeUnknownExit(AnonymousId);
360
- const isTruthyEnvValue = (value) => [
361
- "1",
362
- "true",
363
- "yes",
364
- "on"
365
- ].includes(String(value ?? "").trim().toLowerCase());
366
396
  function shouldDisableTelemetry() {
367
- return isTruthyEnvValue(process.env.CI) || isTruthyEnvValue(process.env.GITHUB_ACTIONS) || process.env.CREATE_PRISMA_DISABLE_TELEMETRY !== void 0 || process.env.CREATE_PRISMA_TELEMETRY_DISABLED !== void 0 || process.env.DO_NOT_TRACK !== void 0;
397
+ return true;
368
398
  }
369
399
  function getTelemetryConfigDir() {
370
400
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -387,7 +417,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
387
417
  return anonymousId;
388
418
  });
389
419
  const getCommonProperties = () => ({
390
- "cli-version": "0.12.0",
420
+ "cli-version": "0.12.1-pr.85.342.1",
391
421
  "node-version": process.version,
392
422
  platform: process.platform,
393
423
  arch: process.arch
@@ -426,6 +456,7 @@ const CREATE_PRISMA_NEXT_CANCELLED_EVENT = "cli:create_prisma_next_command_cance
426
456
  const expectedRejectionReasons = new Set([
427
457
  "invalid_input",
428
458
  "unsupported_node_version",
459
+ "unsupported_package_manager_version",
429
460
  "invalid_project_name",
430
461
  "target_path_not_directory",
431
462
  "target_directory_not_empty",
@@ -472,6 +503,9 @@ function getErrorCode(error) {
472
503
  const code = Reflect.get(error, "code");
473
504
  return typeof code === "number" || typeof code === "string" ? code : null;
474
505
  }
506
+ function getChildProcessFailureProperty(error) {
507
+ return error instanceof CommandExecutionError || error instanceof PrismaCliCommandError ? error.childProcessFailure ?? null : null;
508
+ }
475
509
  function getPrismaCliFailureProperty(error, property) {
476
510
  if (typeof error !== "object" || error === null) return null;
477
511
  const value = Reflect.get(error, property);
@@ -492,6 +526,7 @@ const trackCreateFailedEffect = Effect.fn("Telemetry.createFailed")(function* (p
492
526
  "failure-reason": params.reason,
493
527
  "error-name": getErrorName(params.error),
494
528
  "error-code": getErrorCode(params.error),
529
+ "child-process-failure": getChildProcessFailureProperty(params.error),
495
530
  "prisma-cli-command": getPrismaCliFailureProperty(params.error, "prismaCliCommand"),
496
531
  "prisma-cli-error-code": getPrismaCliFailureProperty(params.error, "prismaCliErrorCode")
497
532
  }).pipe(Effect.scoped, Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
@@ -508,11 +543,27 @@ const trackCreateCancelledEffect = Effect.fn("Telemetry.createCancelled")(functi
508
543
  //#region src/utils/package-manager.ts
509
544
  const DENO_ALLOW_FRESH_DEPENDENCIES = "--minimum-dependency-age=0";
510
545
  const packageManagerManifestValues = {
511
- npm: "npm@10.9.0",
546
+ npm: "npm@11.6.0",
512
547
  pnpm: "pnpm@11.21.0",
513
548
  yarn: "yarn@4.13.0",
514
- bun: "bun@1.3.9"
549
+ bun: "bun@1.4.1"
515
550
  };
551
+ const verifyPackageManagerEffect = Effect.fn("PackageManager.verify")(function* (packageManager) {
552
+ if (packageManager !== "npm") return;
553
+ const version = (yield* (yield* CommandRunner).runChecked({
554
+ command: "npm",
555
+ args: ["--version"],
556
+ cwd: process.cwd()
557
+ })).stdout.trim();
558
+ const parts = version.split(".").map(Number);
559
+ if (!/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)$/.test(version) || parts.some((part) => !Number.isInteger(part))) return yield* Effect.fail(/* @__PURE__ */ new Error(`Could not determine the installed npm version: ${version}`));
560
+ const [major, minor] = parts;
561
+ if (major < 11 || major === 11 && minor < 6) return yield* new CreateFailure({
562
+ stage: "validate_input",
563
+ reason: "unsupported_package_manager_version",
564
+ message: `npm ${version} is unsupported. Required: npm 11.6.0 or newer. Older npm releases can crash while resolving Prisma dependencies. Run npm install --global npm@11, then retry create-prisma.`
565
+ });
566
+ });
516
567
  function parseUserAgent(userAgent) {
517
568
  if (userAgent?.startsWith("pnpm")) return "pnpm";
518
569
  if (userAgent?.startsWith("yarn")) return "yarn";
@@ -1092,7 +1143,8 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
1092
1143
  return yield* new PrismaCliCommandError({
1093
1144
  message: redactSecrets(result.stderr.trim() || result.stdout.trim()) || getErrorMessage(cause),
1094
1145
  stderr: redactSecrets(result.stderr),
1095
- exitCode: result.exitCode
1146
+ exitCode: result.exitCode,
1147
+ childProcessFailure: result.childProcessFailure
1096
1148
  });
1097
1149
  }
1098
1150
  if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) return yield* new PrismaCliCommandError({
@@ -1100,7 +1152,8 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
1100
1152
  ...envelope.commandId || envelope.command ? { command: envelope.commandId ?? envelope.command } : {},
1101
1153
  ...envelope.error?.code ? { code: envelope.error.code } : {},
1102
1154
  stderr: redactSecrets(result.stderr),
1103
- exitCode: result.exitCode
1155
+ exitCode: result.exitCode,
1156
+ childProcessFailure: result.childProcessFailure
1104
1157
  });
1105
1158
  return envelope.result;
1106
1159
  });
@@ -2172,6 +2225,7 @@ const createProjectEffect = Effect.fn("Create.project")(function* (rawInput, inp
2172
2225
  yield* Effect.sync(() => intro(getCreatePrismaIntro(), { output }));
2173
2226
  const context = yield* atCreateStage(collectCreateContext(input), "collect_context", "unexpected_error");
2174
2227
  yield* Ref.set(contextRef, Option.some(context));
2228
+ yield* atCreateStage(verifyPackageManagerEffect(context.prismaSetupContext.packageManager), "install_dependencies", "dependency_install_failed");
2175
2229
  return {
2176
2230
  input,
2177
2231
  context,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.12.0",
3
+ "version": "0.12.1-pr.85.342.1",
4
4
  "private": false,
5
5
  "description": "Create Prisma 8 projects with first-party templates and great DX.",
6
6
  "homepage": "https://github.com/prisma/create-prisma",
@@ -72,5 +72,5 @@
72
72
  "bun": ">=1.3.0",
73
73
  "node": ">=22.18.0"
74
74
  },
75
- "packageManager": "bun@1.3.9"
75
+ "packageManager": "bun@1.4.1"
76
76
  }
@@ -7,7 +7,7 @@ import { nextjsBuild } from "@prisma/composer/nextjs/control";
7
7
  import { prismaCloud, prismaState } from "@prisma/composer-prisma-cloud/control";
8
8
 
9
9
  export default defineConfig({
10
- extensions: [prismaCloud(), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
10
+ extensions: [prismaCloud({ region: "us-east-1" }), nodeBuild(){{#if (eq template "next")}}, nextjsBuild(){{/if}}],
11
11
  state: prismaState(),
12
12
  });
13
13
  {{/unless}}