create-prisma 0.13.0 → 0.13.1-pr.105.359.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-C_8wEM4e.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-C_8wEM4e.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-pr.105.359.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,
@@ -353,20 +388,14 @@ const applicationRuntime = ManagedRuntime.make(ApplicationLayer);
353
388
 
354
389
  //#endregion
355
390
  //#region src/telemetry/client.ts
356
- const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
391
+ const TELEMETRY_API_KEY = "";
357
392
  const TELEMETRY_HOST = "https://us.i.posthog.com";
358
393
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
359
394
  const TELEMETRY_TIMEOUT_MS = 2e3;
360
395
  const AnonymousId = Schema.String.check(Schema.isUUID(4));
361
396
  const decodeAnonymousId = Schema.decodeUnknownExit(AnonymousId);
362
- const isTruthyEnvValue = (value) => [
363
- "1",
364
- "true",
365
- "yes",
366
- "on"
367
- ].includes(String(value ?? "").trim().toLowerCase());
368
397
  function shouldDisableTelemetry() {
369
- 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;
398
+ return true;
370
399
  }
371
400
  function getTelemetryConfigDir() {
372
401
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -389,7 +418,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
389
418
  return anonymousId;
390
419
  });
391
420
  const getCommonProperties = () => ({
392
- "cli-version": "0.13.0",
421
+ "cli-version": "0.13.1-pr.105.359.1",
393
422
  "node-version": process.version,
394
423
  platform: process.platform,
395
424
  arch: process.arch
@@ -475,6 +504,9 @@ function getErrorCode(error) {
475
504
  const code = Reflect.get(error, "code");
476
505
  return typeof code === "number" || typeof code === "string" ? code : null;
477
506
  }
507
+ function getChildProcessFailureProperty(error) {
508
+ return error instanceof CommandExecutionError || error instanceof PrismaCliCommandError ? error.childProcessFailure ?? null : null;
509
+ }
478
510
  function getPrismaCliFailureProperty(error, property) {
479
511
  if (typeof error !== "object" || error === null) return null;
480
512
  const value = Reflect.get(error, property);
@@ -495,6 +527,7 @@ const trackCreateFailedEffect = Effect.fn("Telemetry.createFailed")(function* (p
495
527
  "failure-reason": params.reason,
496
528
  "error-name": getErrorName(params.error),
497
529
  "error-code": getErrorCode(params.error),
530
+ "child-process-failure": getChildProcessFailureProperty(params.error),
498
531
  "prisma-cli-command": getPrismaCliFailureProperty(params.error, "prismaCliCommand"),
499
532
  "prisma-cli-error-code": getPrismaCliFailureProperty(params.error, "prismaCliErrorCode")
500
533
  }).pipe(Effect.scoped, Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
@@ -507,6 +540,86 @@ const trackCreateCancelledEffect = Effect.fn("Telemetry.createCancelled")(functi
507
540
  }).pipe(Effect.scoped, Effect.timeout(TELEMETRY_TIMEOUT_MS), Effect.catch(() => Effect.void));
508
541
  });
509
542
 
543
+ //#endregion
544
+ //#region src/constants/dependencies.ts
545
+ const dependencyVersionMap = {
546
+ "@astrojs/node": "^10.0.2",
547
+ "@elysiajs/node": "^1.4.5",
548
+ "@prisma/composer": "0.20.0",
549
+ "@prisma/composer-prisma-cloud": "0.20.0",
550
+ "@prisma/dev": "0.25.2",
551
+ "@prisma/orm-mongo": "8.0.0-rc.11",
552
+ "@prisma/orm-postgres": "8.0.0-rc.11",
553
+ "@sveltejs/adapter-node": "^5.3.2",
554
+ "@types/node": "^25.6.2",
555
+ alchemy: "2.0.0-beta.74",
556
+ arktype: "^2.2.3",
557
+ dotenv: "^17.4.2",
558
+ effect: "4.0.0-rc.112",
559
+ mongodb: "^7.1.0",
560
+ "mongodb-memory-server": "^11.1.0",
561
+ nitro: "^3.0.260610-beta",
562
+ prisma: "8.0.0-rc.15",
563
+ "temporal-polyfill": "^1.0.4",
564
+ tsdown: "^0.22.14",
565
+ turbo: "2.10.12",
566
+ tsx: "^4.21.0",
567
+ typescript: "^5.9.3"
568
+ };
569
+ const PRISMA_PLATFORM_CLI_PACKAGE = `prisma@${dependencyVersionMap.prisma}`;
570
+ const PRISMA_DENO_CLI_PACKAGE = PRISMA_PLATFORM_CLI_PACKAGE;
571
+ function getDependencyVersion(packageName) {
572
+ return dependencyVersionMap[packageName];
573
+ }
574
+ function usesTsdown(template) {
575
+ return template === "minimal" || template === "hono" || template === "elysia" || template === "nest";
576
+ }
577
+ function getCreateTemplateDependencies(template, packageManager) {
578
+ const dependencies = [
579
+ "@prisma/composer",
580
+ "@prisma/composer-prisma-cloud",
581
+ "alchemy"
582
+ ];
583
+ const devDependencies = [];
584
+ if (usesTsdown(template)) {
585
+ devDependencies.push("tsdown");
586
+ devDependencies.push("tsx");
587
+ }
588
+ if (template === "minimal") devDependencies.push("typescript");
589
+ if (template === "elysia") {
590
+ dependencies.push("@elysiajs/node");
591
+ devDependencies.push("@types/node");
592
+ }
593
+ if (template === "svelte") devDependencies.push("@sveltejs/adapter-node");
594
+ if (template === "astro") dependencies.push("@astrojs/node");
595
+ if (template === "tanstack-start") devDependencies.push("nitro");
596
+ if (template === "turborepo") devDependencies.push("turbo", "typescript");
597
+ const targets = [{
598
+ packageJsonPath: "package.json",
599
+ dependencies,
600
+ devDependencies
601
+ }];
602
+ if (template === "turborepo") {
603
+ targets.push({
604
+ packageJsonPath: "apps/server/package.json",
605
+ dependencies: [],
606
+ devDependencies: [
607
+ "@types/node",
608
+ "tsdown",
609
+ "tsx",
610
+ "typescript"
611
+ ],
612
+ customDependencies: { "@repo/database": packageManager === "npm" ? "*" : "workspace:*" }
613
+ });
614
+ targets.push({
615
+ packageJsonPath: "packages/database/package.json",
616
+ dependencies: [],
617
+ devDependencies: ["typescript"]
618
+ });
619
+ }
620
+ return targets;
621
+ }
622
+
510
623
  //#endregion
511
624
  //#region src/utils/package-manager.ts
512
625
  const DENO_ALLOW_FRESH_DEPENDENCIES = "--minimum-dependency-age=0";
@@ -657,7 +770,7 @@ function getLocalPackageBinaryArgs(packageManager, binaryName, binaryArgs) {
657
770
  "run",
658
771
  "-A",
659
772
  "--frozen",
660
- `npm:${binaryName}@latest`,
773
+ `npm:${binaryName}@${getDependencyVersion(binaryName) ?? "latest"}`,
661
774
  ...binaryArgs
662
775
  ]
663
776
  };
@@ -836,86 +949,6 @@ const scaffoldCreateTemplateEffect = Effect.fn("Templates.scaffold")(function* (
836
949
  yield* scaffoldCreateSharedTemplatesEffect(options);
837
950
  });
838
951
 
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
952
  //#endregion
920
953
  //#region src/constants/db-packages.ts
921
954
  function getDbPackages(provider) {
@@ -1156,7 +1189,8 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
1156
1189
  return yield* new PrismaCliCommandError({
1157
1190
  message: redactSecrets(result.stderr.trim() || result.stdout.trim()) || getErrorMessage(cause),
1158
1191
  stderr: redactSecrets(result.stderr),
1159
- exitCode: result.exitCode
1192
+ exitCode: result.exitCode,
1193
+ childProcessFailure: result.childProcessFailure
1160
1194
  });
1161
1195
  }
1162
1196
  if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) return yield* new PrismaCliCommandError({
@@ -1164,7 +1198,8 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
1164
1198
  ...envelope.commandId || envelope.command ? { command: envelope.commandId ?? envelope.command } : {},
1165
1199
  ...envelope.error?.code ? { code: envelope.error.code } : {},
1166
1200
  stderr: redactSecrets(result.stderr),
1167
- exitCode: result.exitCode
1201
+ exitCode: result.exitCode,
1202
+ childProcessFailure: result.childProcessFailure
1168
1203
  });
1169
1204
  return envelope.result;
1170
1205
  });
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-pr.105.359.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"