create-prisma 0.11.5 → 0.11.6-pr.93.320.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
@@ -61,7 +61,7 @@ older cached version. Prisma Compute does not support Deno deployments yet.
61
61
  - `--deploy` / `--no-deploy`
62
62
  - `--workspace <id-or-name>`
63
63
  - `--yes`
64
- - `--force`
64
+ - `--force`: overwrite generated starter and Prisma files in a non-empty directory. This replaces existing Prisma config, contract, and database-client files; back up edits first.
65
65
  - `--verbose`
66
66
  - `--json`
67
67
 
package/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { a as ApplicationLayer } from "./json-output-Cfqb5N0F.mjs";
2
+ import { a as ApplicationLayer } from "./json-output-D6-jjQyu.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.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
- import { _ as databaseProviderInputs, c as CreateCommandResultSchema, d as CreateCommandInputSchema, f as CreateTemplateSchema, g as createTemplates, h as authoringStyles, i as getErrorMessage, l as createCommandFailureResult, m as PackageManagerSchema, n as writeJsonResult, o as applicationRuntime, p as DatabaseProviderSchema, r as runCreateCommandEffect, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as isJsonOutputRequested, u as AuthoringStyleSchema, v as normalizeDatabaseProvider, y as packageManagers } from "./json-output-Cfqb5N0F.mjs";
2
+ import { _ as databaseProviderInputs, c as CreateCommandResultSchema, d as CreateCommandInputSchema, f as CreateTemplateSchema, g as createTemplates, h as authoringStyles, i as getErrorMessage, l as createCommandFailureResult, m as PackageManagerSchema, n as writeJsonResult, o as applicationRuntime, p as DatabaseProviderSchema, r as runCreateCommandEffect, s as CREATE_PRISMA_RESULT_SCHEMA_VERSION, t as isJsonOutputRequested, u as AuthoringStyleSchema, v as normalizeDatabaseProvider, y as packageManagers } from "./json-output-D6-jjQyu.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.11.5";
7
+ const CLI_VERSION = "0.11.6-pr.93.320.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));
@@ -17,7 +17,7 @@ const createPrismaCommand = Command.make("create-prisma", {
17
17
  packageManager: Flag.choice("package-manager", packageManagers).pipe(Flag.withDescription("Package manager used for dependency installation"), Flag.optional, Flag.map(Option.getOrUndefined)),
18
18
  deploy: optionalBoolean("deploy", "Deploy the generated app to Prisma immediately"),
19
19
  workspace: optionalString("workspace", "Prisma workspace id or name to deploy into"),
20
- force: optionalBoolean("force", "Allow scaffolding into a non-empty target directory"),
20
+ force: optionalBoolean("force", "Overwrite generated starter and Prisma files in a non-empty directory"),
21
21
  yes: optionalBoolean("yes", "Skip prompts and accept default choices"),
22
22
  verbose: optionalBoolean("verbose", "Show verbose command output during setup"),
23
23
  json: optionalBoolean("json", "Emit one quiet JSON result for agents and automation (non-interactive; deploys unless --no-deploy)")
@@ -309,20 +309,14 @@ const applicationRuntime = ManagedRuntime.make(ApplicationLayer);
309
309
 
310
310
  //#endregion
311
311
  //#region src/telemetry/client.ts
312
- const TELEMETRY_API_KEY = "phc_cmc85avbWyuJ2JyKdGPdv7dxXli8xLdWDBPbvIXWJfs";
312
+ const TELEMETRY_API_KEY = "";
313
313
  const TELEMETRY_HOST = "https://us.i.posthog.com";
314
314
  const TELEMETRY_CONFIG_FILE = "telemetry.json";
315
315
  const TELEMETRY_TIMEOUT_MS = 2e3;
316
316
  const AnonymousId = Schema.String.check(Schema.isUUID(4));
317
317
  const decodeAnonymousId = Schema.decodeUnknownExit(AnonymousId);
318
- const isTruthyEnvValue = (value) => [
319
- "1",
320
- "true",
321
- "yes",
322
- "on"
323
- ].includes(String(value ?? "").trim().toLowerCase());
324
318
  function shouldDisableTelemetry() {
325
- 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;
319
+ return true;
326
320
  }
327
321
  function getTelemetryConfigDir() {
328
322
  if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
@@ -345,7 +339,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
345
339
  return anonymousId;
346
340
  });
347
341
  const getCommonProperties = () => ({
348
- "cli-version": "0.11.5",
342
+ "cli-version": "0.11.6-pr.93.320.1",
349
343
  "node-version": process.version,
350
344
  platform: process.platform,
351
345
  arch: process.arch
@@ -985,6 +979,7 @@ function redactSecrets(message) {
985
979
  return message.replace(/\b((?:(?:prisma\+)?postgres(?:ql)?|mongodb(?:\+srv)?):\/\/)[^\s'"]+/gi, "$1<redacted>").replace(/\b([A-Z0-9_]*(?:MONGODB_(?:URL|URI)|DATABASE_URL|TOKEN|SECRET|PASSWORD|API_KEY|PRIVATE_KEY)[A-Z0-9_]*\s*=\s*)(?:"[^"]*"|'[^']*'|[^\s]+)/gi, "$1<redacted>").replace(/(\bAuthorization\s*:\s*Bearer\s+)[^\s'"]+/gi, "$1<redacted>");
986
980
  }
987
981
  function getErrorMessage(error) {
982
+ if (error instanceof PrismaCliCommandError) return redactSecrets(error.message);
988
983
  if (error instanceof Error && "stderr" in error) {
989
984
  const stderr = String(error.stderr ?? "").trim();
990
985
  if (stderr) return redactSecrets(stderr);
@@ -1002,7 +997,7 @@ const atCreateStage = (effect, stage, reason) => effect.pipe(Effect.mapError((er
1002
997
  })));
1003
998
 
1004
999
  //#endregion
1005
- //#region src/tasks/composer/prisma-cli.ts
1000
+ //#region src/tasks/prisma-cli.ts
1006
1001
  const PrismaCliEnvelopeSchema = Schema.Struct({
1007
1002
  ok: Schema.Boolean,
1008
1003
  command: Schema.optionalKey(Schema.String),
@@ -1036,7 +1031,7 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
1036
1031
  command: invocation.command,
1037
1032
  args: invocation.args,
1038
1033
  cwd: options.projectDir,
1039
- env: process.env,
1034
+ env: options.env ?? process.env,
1040
1035
  ...options.onStderrLine ? { onStderrLine: options.onStderrLine } : {}
1041
1036
  });
1042
1037
  let envelope;
@@ -1044,16 +1039,16 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
1044
1039
  envelope = parsePrismaCliEnvelope(result.stdout);
1045
1040
  } catch (cause) {
1046
1041
  return yield* new PrismaCliCommandError({
1047
- message: result.stderr.trim() || getErrorMessage(cause),
1048
- stderr: result.stderr,
1042
+ message: redactSecrets(result.stderr.trim() || result.stdout.trim()) || getErrorMessage(cause),
1043
+ stderr: redactSecrets(result.stderr),
1049
1044
  exitCode: result.exitCode
1050
1045
  });
1051
1046
  }
1052
1047
  if (result.exitCode !== 0 || !envelope.ok || envelope.result === void 0) return yield* new PrismaCliCommandError({
1053
- message: [envelope.error?.summary ?? envelope.error?.message, envelope.error?.why].filter(Boolean).join(": ") || result.stderr.trim() || "Prisma CLI command failed.",
1048
+ message: redactSecrets([envelope.error?.summary ?? envelope.error?.message, envelope.error?.why].filter(Boolean).join(": ") || result.stderr.trim() || "Prisma CLI command failed."),
1054
1049
  ...envelope.commandId || envelope.command ? { command: envelope.commandId ?? envelope.command } : {},
1055
1050
  ...envelope.error?.code ? { code: envelope.error.code } : {},
1056
- stderr: result.stderr,
1051
+ stderr: redactSecrets(result.stderr),
1057
1052
  exitCode: result.exitCode
1058
1053
  });
1059
1054
  return envelope.result;
@@ -1451,24 +1446,23 @@ const runPrismaCli = Effect.fn("PrismaSetup.runCli")(function* (context, project
1451
1446
  yield* Effect.sync(() => {
1452
1447
  if (context.verbose) log.step([invocation.command, ...invocation.args].join(" "), { output: context.output });
1453
1448
  });
1454
- yield* runSetupCommand({
1455
- command: invocation.command,
1456
- args: invocation.args,
1457
- cwd: projectDir,
1449
+ yield* runPrismaJsonCommandEffect({
1450
+ packageManager: context.packageManager,
1451
+ projectDir,
1452
+ args,
1458
1453
  env: {
1459
1454
  ...process.env,
1460
1455
  CI: "1"
1461
1456
  },
1462
- verbose: context.verbose,
1463
- json: context.json
1457
+ ...context.verbose ? { onStderrLine: (line) => log.message(redactSecrets(line), { output: context.output }) } : {}
1464
1458
  });
1465
1459
  });
1466
- const runPrismaInit = Effect.fn("PrismaSetup.init")(function* (context, projectDir) {
1460
+ const runPrismaInit = Effect.fn("PrismaSetup.init")(function* (context, projectDir, force = false) {
1467
1461
  yield* runPrismaCli(context, projectDir, [
1468
1462
  "orm",
1469
1463
  "init",
1470
1464
  "--yes",
1471
- "--no-interactive",
1465
+ ...force ? ["--confirm", path.basename(projectDir).trim() || projectDir.trim()] : [],
1472
1466
  "--target",
1473
1467
  getInitTarget(context.databaseProvider),
1474
1468
  "--authoring",
@@ -1481,11 +1475,7 @@ const runPrismaInit = Effect.fn("PrismaSetup.init")(function* (context, projectD
1481
1475
  });
1482
1476
  const initializeAgentSkills = Effect.fn("PrismaSetup.initializeSkills")(function* (context, projectDir) {
1483
1477
  if (context.packageManager === "deno") return;
1484
- yield* runPrismaCli(context, projectDir, [
1485
- "init",
1486
- "--yes",
1487
- "--no-interactive"
1488
- ]);
1478
+ yield* runPrismaCli(context, projectDir, ["init", "--yes"]);
1489
1479
  });
1490
1480
 
1491
1481
  //#endregion
@@ -1719,7 +1709,7 @@ const executePrismaSetupContextEffect = Effect.fn("PrismaSetup.execute")(functio
1719
1709
  json: context.json
1720
1710
  }), "install_dependencies", "dependency_install_failed");
1721
1711
  yield* Effect.sync(() => progress?.message("Preparing Prisma 8 project files..."));
1722
- yield* atCreateStage(runPrismaInit(context, projectDir), "initialize_prisma", "prisma_init_failed");
1712
+ yield* atCreateStage(runPrismaInit(context, projectDir, options.force), "initialize_prisma", "prisma_init_failed");
1723
1713
  yield* atCreateStage(Effect.gen(function* () {
1724
1714
  yield* scaffoldCreateSharedTemplatesEffect({
1725
1715
  projectDir,
@@ -2038,6 +2028,7 @@ const executeCreateContext = Effect.fn("Create.execute")(function* (context) {
2038
2028
  template: context.template,
2039
2029
  createdProjectPath: context.targetDirectory,
2040
2030
  includeDevNextStep: true,
2031
+ force: context.force,
2041
2032
  initializeGit: !context.targetPathState.exists || context.targetPathState.isEmptyDirectory,
2042
2033
  progressSpinner: createSpinner
2043
2034
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-prisma",
3
- "version": "0.11.5",
3
+ "version": "0.11.6-pr.93.320.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",