create-prisma 0.13.0 → 0.13.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/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as ApplicationLayer } from "./json-output-Bpk7rG2T.mjs";
2
+ import { a as ApplicationLayer } from "./json-output-CPdx9Prn.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-Bpk7rG2T.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-CPdx9Prn.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.13.0";
7
+ const CLI_VERSION = "0.13.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",
@@ -94,7 +124,8 @@ var PrismaCliCommandError = class extends Schema.TaggedError()("PrismaCliCommand
94
124
  command: Schema.optionalKey(Schema.String),
95
125
  code: Schema.optionalKey(Schema.String),
96
126
  stderr: Schema.optionalKey(Schema.String),
97
- exitCode: Schema.optionalKey(Schema.Number)
127
+ exitCode: Schema.optionalKey(Schema.Number),
128
+ childProcessFailure: Schema.optional(ChildProcessFailureSchema)
98
129
  }) {
99
130
  prismaCliCommand = this.command;
100
131
  prismaCliErrorCode = this.code;
@@ -284,7 +315,8 @@ var CommandExecutionError = class extends Schema.TaggedError()("CommandExecution
284
315
  exitCode: Schema.optionalKey(Schema.Number),
285
316
  stdout: Schema.String,
286
317
  stderr: Schema.String,
287
- cause: Schema.optionalKey(Schema.Defect())
318
+ cause: Schema.optionalKey(Schema.Defect()),
319
+ childProcessFailure: Schema.optional(ChildProcessFailureSchema)
288
320
  }) {
289
321
  get message() {
290
322
  const detail = this.stderr.trim() || this.stdout.trim();
@@ -320,7 +352,8 @@ var CommandRunner = class CommandRunner extends Context.Service()("create-prisma
320
352
  return {
321
353
  exitCode: result.exitCode ?? 1,
322
354
  stdout: typeof result.stdout === "string" ? result.stdout : "",
323
- stderr: typeof result.stderr === "string" ? result.stderr : ""
355
+ stderr: typeof result.stderr === "string" ? result.stderr : "",
356
+ childProcessFailure: getChildProcessFailure(result)
324
357
  };
325
358
  },
326
359
  catch: (cause) => new CommandExecutionError({
@@ -328,7 +361,8 @@ var CommandRunner = class CommandRunner extends Context.Service()("create-prisma
328
361
  args: [...spec.args],
329
362
  stdout: "",
330
363
  stderr: "",
331
- cause
364
+ cause,
365
+ childProcessFailure: getChildProcessFailure(cause)
332
366
  })
333
367
  }));
334
368
  const runChecked = Effect.fn("CommandRunner.runChecked")((spec) => Effect.flatMap(run(spec), (result) => result.exitCode === 0 ? Effect.succeed(result) : Effect.fail(new CommandExecutionError({
@@ -336,7 +370,8 @@ var CommandRunner = class CommandRunner extends Context.Service()("create-prisma
336
370
  args: [...spec.args],
337
371
  exitCode: result.exitCode,
338
372
  stdout: result.stdout,
339
- stderr: result.stderr
373
+ stderr: result.stderr,
374
+ childProcessFailure: result.childProcessFailure
340
375
  }))));
341
376
  return CommandRunner.of({
342
377
  run,
@@ -389,7 +424,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
389
424
  return anonymousId;
390
425
  });
391
426
  const getCommonProperties = () => ({
392
- "cli-version": "0.13.0",
427
+ "cli-version": "0.13.1",
393
428
  "node-version": process.version,
394
429
  platform: process.platform,
395
430
  arch: process.arch
@@ -475,6 +510,9 @@ function getErrorCode(error) {
475
510
  const code = Reflect.get(error, "code");
476
511
  return typeof code === "number" || typeof code === "string" ? code : null;
477
512
  }
513
+ function getChildProcessFailureProperty(error) {
514
+ return error instanceof CommandExecutionError || error instanceof PrismaCliCommandError ? error.childProcessFailure ?? null : null;
515
+ }
478
516
  function getPrismaCliFailureProperty(error, property) {
479
517
  if (typeof error !== "object" || error === null) return null;
480
518
  const value = Reflect.get(error, property);
@@ -495,6 +533,7 @@ const trackCreateFailedEffect = Effect.fn("Telemetry.createFailed")(function* (p
495
533
  "failure-reason": params.reason,
496
534
  "error-name": getErrorName(params.error),
497
535
  "error-code": getErrorCode(params.error),
536
+ "child-process-failure": getChildProcessFailureProperty(params.error),
498
537
  "prisma-cli-command": getPrismaCliFailureProperty(params.error, "prismaCliCommand"),
499
538
  "prisma-cli-error-code": getPrismaCliFailureProperty(params.error, "prismaCliErrorCode")
500
539
  }).pipe(Effect.scoped, Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
@@ -507,6 +546,86 @@ const trackCreateCancelledEffect = Effect.fn("Telemetry.createCancelled")(functi
507
546
  }).pipe(Effect.scoped, Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
508
547
  });
509
548
 
549
+ //#endregion
550
+ //#region src/constants/dependencies.ts
551
+ const dependencyVersionMap = {
552
+ "@astrojs/node": "^10.0.2",
553
+ "@elysiajs/node": "^1.4.5",
554
+ "@prisma/composer": "0.20.0",
555
+ "@prisma/composer-prisma-cloud": "0.20.0",
556
+ "@prisma/dev": "0.25.2",
557
+ "@prisma/orm-mongo": "8.0.0-rc.11",
558
+ "@prisma/orm-postgres": "8.0.0-rc.11",
559
+ "@sveltejs/adapter-node": "^5.3.2",
560
+ "@types/node": "^25.6.2",
561
+ alchemy: "2.0.0-beta.74",
562
+ arktype: "^2.2.3",
563
+ dotenv: "^17.4.2",
564
+ effect: "4.0.0-rc.112",
565
+ mongodb: "^7.1.0",
566
+ "mongodb-memory-server": "^11.1.0",
567
+ nitro: "^3.0.260610-beta",
568
+ prisma: "8.0.0-rc.15",
569
+ "temporal-polyfill": "^1.0.4",
570
+ tsdown: "^0.22.14",
571
+ turbo: "2.10.12",
572
+ tsx: "^4.21.0",
573
+ typescript: "^5.9.3"
574
+ };
575
+ const PRISMA_PLATFORM_CLI_PACKAGE = `prisma@${dependencyVersionMap.prisma}`;
576
+ const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
577
+ function getDependencyVersion(packageName) {
578
+ return dependencyVersionMap[packageName];
579
+ }
580
+ function usesTsdown(template) {
581
+ return template === "minimal" || template === "hono" || template === "elysia" || template === "nest";
582
+ }
583
+ function getCreateTemplateDependencies(template, packageManager) {
584
+ const dependencies = [
585
+ "@prisma/composer",
586
+ "@prisma/composer-prisma-cloud",
587
+ "alchemy"
588
+ ];
589
+ const devDependencies = [];
590
+ if (usesTsdown(template)) {
591
+ devDependencies.push("tsdown");
592
+ devDependencies.push("tsx");
593
+ }
594
+ if (template === "minimal") devDependencies.push("typescript");
595
+ if (template === "elysia") {
596
+ dependencies.push("@elysiajs/node");
597
+ devDependencies.push("@types/node");
598
+ }
599
+ if (template === "svelte") devDependencies.push("@sveltejs/adapter-node");
600
+ if (template === "astro") dependencies.push("@astrojs/node");
601
+ if (template === "tanstack-start") devDependencies.push("nitro");
602
+ if (template === "turborepo") devDependencies.push("turbo", "typescript");
603
+ const targets = [{
604
+ packageJsonPath: "package.json",
605
+ dependencies,
606
+ devDependencies
607
+ }];
608
+ if (template === "turborepo") {
609
+ targets.push({
610
+ packageJsonPath: "apps/server/package.json",
611
+ dependencies: [],
612
+ devDependencies: [
613
+ "@types/node",
614
+ "tsdown",
615
+ "tsx",
616
+ "typescript"
617
+ ],
618
+ customDependencies: { "@repo/database": packageManager === "npm" ? "*" : "workspace:*" }
619
+ });
620
+ targets.push({
621
+ packageJsonPath: "packages/database/package.json",
622
+ dependencies: [],
623
+ devDependencies: ["typescript"]
624
+ });
625
+ }
626
+ return targets;
627
+ }
628
+
510
629
  //#endregion
511
630
  //#region src/utils/package-manager.ts
512
631
  const DENO_ALLOW_FRESH_DEPENDENCIES = "--minimum-dependency-age=0";
@@ -657,7 +776,7 @@ function getLocalPackageBinaryArgs(packageManager, binaryName, binaryArgs) {
657
776
  "run",
658
777
  "-A",
659
778
  "--frozen",
660
- `npm:${binaryName}@latest`,
779
+ `npm:${binaryName}@${getDependencyVersion(binaryName) ?? "latest"}`,
661
780
  ...binaryArgs
662
781
  ]
663
782
  };
@@ -836,86 +955,6 @@ const scaffoldCreateTemplateEffect = Effect.fn("Templates.scaffold")(function* (
836
955
  yield* scaffoldCreateSharedTemplatesEffect(options);
837
956
  });
838
957
 
839
- //#endregion
840
- //#region src/constants/dependencies.ts
841
- const dependencyVersionMap = {
842
- "@astrojs/node": "^10.0.2",
843
- "@elysiajs/node": "^1.4.5",
844
- "@prisma/composer": "0.19.0",
845
- "@prisma/composer-prisma-cloud": "0.19.0",
846
- "@prisma/dev": "0.25.2",
847
- "@prisma/orm-mongo": "8.0.0-rc.10",
848
- "@prisma/orm-postgres": "8.0.0-rc.10",
849
- "@sveltejs/adapter-node": "^5.3.2",
850
- "@types/node": "^25.6.2",
851
- alchemy: "2.0.0-beta.74",
852
- arktype: "^2.2.3",
853
- dotenv: "^17.4.2",
854
- effect: "4.0.0-rc.112",
855
- mongodb: "^7.1.0",
856
- "mongodb-memory-server": "^11.1.0",
857
- nitro: "^3.0.260610-beta",
858
- prisma: "latest",
859
- "temporal-polyfill": "^1.0.4",
860
- tsdown: "^0.22.14",
861
- turbo: "2.10.12",
862
- tsx: "^4.21.0",
863
- typescript: "^5.9.3"
864
- };
865
- const PRISMA_PLATFORM_CLI_PACKAGE = "prisma@latest";
866
- const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
867
- function getDependencyVersion(packageName) {
868
- return dependencyVersionMap[packageName];
869
- }
870
- function usesTsdown(template) {
871
- return template === "minimal" || template === "hono" || template === "elysia" || template === "nest";
872
- }
873
- function getCreateTemplateDependencies(template, packageManager) {
874
- const dependencies = [
875
- "@prisma/composer",
876
- "@prisma/composer-prisma-cloud",
877
- "alchemy"
878
- ];
879
- const devDependencies = [];
880
- if (usesTsdown(template)) {
881
- devDependencies.push("tsdown");
882
- devDependencies.push("tsx");
883
- }
884
- if (template === "minimal") devDependencies.push("typescript");
885
- if (template === "elysia") {
886
- dependencies.push("@elysiajs/node");
887
- devDependencies.push("@types/node");
888
- }
889
- if (template === "svelte") devDependencies.push("@sveltejs/adapter-node");
890
- if (template === "astro") dependencies.push("@astrojs/node");
891
- if (template === "tanstack-start") devDependencies.push("nitro");
892
- if (template === "turborepo") devDependencies.push("turbo", "typescript");
893
- const targets = [{
894
- packageJsonPath: "package.json",
895
- dependencies,
896
- devDependencies
897
- }];
898
- if (template === "turborepo") {
899
- targets.push({
900
- packageJsonPath: "apps/server/package.json",
901
- dependencies: [],
902
- devDependencies: [
903
- "@types/node",
904
- "tsdown",
905
- "tsx",
906
- "typescript"
907
- ],
908
- customDependencies: { "@repo/database": packageManager === "npm" ? "*" : "workspace:*" }
909
- });
910
- targets.push({
911
- packageJsonPath: "packages/database/package.json",
912
- dependencies: [],
913
- devDependencies: ["typescript"]
914
- });
915
- }
916
- return targets;
917
- }
918
-
919
958
  //#endregion
920
959
  //#region src/constants/db-packages.ts
921
960
  function getDbPackages(provider) {
@@ -1156,7 +1195,8 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
1156
1195
  return yield* new PrismaCliCommandError({
1157
1196
  message: redactSecrets(result.stderr.trim() || result.stdout.trim()) || getErrorMessage(cause),
1158
1197
  stderr: redactSecrets(result.stderr),
1159
- exitCode: result.exitCode
1198
+ exitCode: result.exitCode,
1199
+ childProcessFailure: result.childProcessFailure
1160
1200
  });
1161
1201
  }
1162
1202
  if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) return yield* new PrismaCliCommandError({
@@ -1164,7 +1204,8 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
1164
1204
  ...envelope.commandId || envelope.command ? { command: envelope.commandId ?? envelope.command } : {},
1165
1205
  ...envelope.error?.code ? { code: envelope.error.code } : {},
1166
1206
  stderr: redactSecrets(result.stderr),
1167
- exitCode: result.exitCode
1207
+ exitCode: result.exitCode,
1208
+ childProcessFailure: result.childProcessFailure
1168
1209
  });
1169
1210
  return envelope.result;
1170
1211
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.13.0",
3
+ "version": "0.13.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",
@@ -45,6 +45,7 @@
45
45
  "format": "oxfmt --write .",
46
46
  "format:check": "oxfmt --check .",
47
47
  "typecheck": "tsc --noEmit",
48
+ "check:pins": "bun run scripts/check-pins.ts",
48
49
  "bump": "bun run scripts/bump-version.ts",
49
50
  "release": "bun run bump",
50
51
  "release-notes": "bunx changelogithub"