create-prisma 0.11.5 → 0.11.6
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
|
|
2
|
+
import { a as ApplicationLayer } from "./json-output--8Kk1Yoh.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
|
|
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--8Kk1Yoh.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.
|
|
7
|
+
const CLI_VERSION = "0.11.6";
|
|
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", "
|
|
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)")
|
|
@@ -345,7 +345,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
|
|
|
345
345
|
return anonymousId;
|
|
346
346
|
});
|
|
347
347
|
const getCommonProperties = () => ({
|
|
348
|
-
"cli-version": "0.11.
|
|
348
|
+
"cli-version": "0.11.6",
|
|
349
349
|
"node-version": process.version,
|
|
350
350
|
platform: process.platform,
|
|
351
351
|
arch: process.arch
|
|
@@ -985,6 +985,7 @@ function redactSecrets(message) {
|
|
|
985
985
|
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
986
|
}
|
|
987
987
|
function getErrorMessage(error) {
|
|
988
|
+
if (error instanceof PrismaCliCommandError) return redactSecrets(error.message);
|
|
988
989
|
if (error instanceof Error && "stderr" in error) {
|
|
989
990
|
const stderr = String(error.stderr ?? "").trim();
|
|
990
991
|
if (stderr) return redactSecrets(stderr);
|
|
@@ -1002,7 +1003,7 @@ const atCreateStage = (effect, stage, reason) => effect.pipe(Effect.mapError((er
|
|
|
1002
1003
|
})));
|
|
1003
1004
|
|
|
1004
1005
|
//#endregion
|
|
1005
|
-
//#region src/tasks/
|
|
1006
|
+
//#region src/tasks/prisma-cli.ts
|
|
1006
1007
|
const PrismaCliEnvelopeSchema = Schema.Struct({
|
|
1007
1008
|
ok: Schema.Boolean,
|
|
1008
1009
|
command: Schema.optionalKey(Schema.String),
|
|
@@ -1036,7 +1037,7 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
|
|
|
1036
1037
|
command: invocation.command,
|
|
1037
1038
|
args: invocation.args,
|
|
1038
1039
|
cwd: options.projectDir,
|
|
1039
|
-
env: process.env,
|
|
1040
|
+
env: options.env ?? process.env,
|
|
1040
1041
|
...options.onStderrLine ? { onStderrLine: options.onStderrLine } : {}
|
|
1041
1042
|
});
|
|
1042
1043
|
let envelope;
|
|
@@ -1044,16 +1045,16 @@ const runPrismaJsonCommandEffect = Effect.fn("PrismaCli.runJson")(function* (opt
|
|
|
1044
1045
|
envelope = parsePrismaCliEnvelope(result.stdout);
|
|
1045
1046
|
} catch (cause) {
|
|
1046
1047
|
return yield* new PrismaCliCommandError({
|
|
1047
|
-
message: result.stderr.trim() || getErrorMessage(cause),
|
|
1048
|
-
stderr: result.stderr,
|
|
1048
|
+
message: redactSecrets(result.stderr.trim() || result.stdout.trim()) || getErrorMessage(cause),
|
|
1049
|
+
stderr: redactSecrets(result.stderr),
|
|
1049
1050
|
exitCode: result.exitCode
|
|
1050
1051
|
});
|
|
1051
1052
|
}
|
|
1052
1053
|
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.",
|
|
1054
|
+
message: redactSecrets([envelope.error?.summary ?? envelope.error?.message, envelope.error?.why].filter(Boolean).join(": ") || result.stderr.trim() || "Prisma CLI command failed."),
|
|
1054
1055
|
...envelope.commandId || envelope.command ? { command: envelope.commandId ?? envelope.command } : {},
|
|
1055
1056
|
...envelope.error?.code ? { code: envelope.error.code } : {},
|
|
1056
|
-
stderr: result.stderr,
|
|
1057
|
+
stderr: redactSecrets(result.stderr),
|
|
1057
1058
|
exitCode: result.exitCode
|
|
1058
1059
|
});
|
|
1059
1060
|
return envelope.result;
|
|
@@ -1451,24 +1452,23 @@ const runPrismaCli = Effect.fn("PrismaSetup.runCli")(function* (context, project
|
|
|
1451
1452
|
yield* Effect.sync(() => {
|
|
1452
1453
|
if (context.verbose) log.step([invocation.command, ...invocation.args].join(" "), { output: context.output });
|
|
1453
1454
|
});
|
|
1454
|
-
yield*
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1455
|
+
yield* runPrismaJsonCommandEffect({
|
|
1456
|
+
packageManager: context.packageManager,
|
|
1457
|
+
projectDir,
|
|
1458
|
+
args,
|
|
1458
1459
|
env: {
|
|
1459
1460
|
...process.env,
|
|
1460
1461
|
CI: "1"
|
|
1461
1462
|
},
|
|
1462
|
-
verbose: context.
|
|
1463
|
-
json: context.json
|
|
1463
|
+
...context.verbose ? { onStderrLine: (line) => log.message(redactSecrets(line), { output: context.output }) } : {}
|
|
1464
1464
|
});
|
|
1465
1465
|
});
|
|
1466
|
-
const runPrismaInit = Effect.fn("PrismaSetup.init")(function* (context, projectDir) {
|
|
1466
|
+
const runPrismaInit = Effect.fn("PrismaSetup.init")(function* (context, projectDir, force = false) {
|
|
1467
1467
|
yield* runPrismaCli(context, projectDir, [
|
|
1468
1468
|
"orm",
|
|
1469
1469
|
"init",
|
|
1470
1470
|
"--yes",
|
|
1471
|
-
"--
|
|
1471
|
+
...force ? ["--confirm", path.basename(projectDir).trim() || projectDir.trim()] : [],
|
|
1472
1472
|
"--target",
|
|
1473
1473
|
getInitTarget(context.databaseProvider),
|
|
1474
1474
|
"--authoring",
|
|
@@ -1481,11 +1481,7 @@ const runPrismaInit = Effect.fn("PrismaSetup.init")(function* (context, projectD
|
|
|
1481
1481
|
});
|
|
1482
1482
|
const initializeAgentSkills = Effect.fn("PrismaSetup.initializeSkills")(function* (context, projectDir) {
|
|
1483
1483
|
if (context.packageManager === "deno") return;
|
|
1484
|
-
yield* runPrismaCli(context, projectDir, [
|
|
1485
|
-
"init",
|
|
1486
|
-
"--yes",
|
|
1487
|
-
"--no-interactive"
|
|
1488
|
-
]);
|
|
1484
|
+
yield* runPrismaCli(context, projectDir, ["init", "--yes"]);
|
|
1489
1485
|
});
|
|
1490
1486
|
|
|
1491
1487
|
//#endregion
|
|
@@ -1719,7 +1715,7 @@ const executePrismaSetupContextEffect = Effect.fn("PrismaSetup.execute")(functio
|
|
|
1719
1715
|
json: context.json
|
|
1720
1716
|
}), "install_dependencies", "dependency_install_failed");
|
|
1721
1717
|
yield* Effect.sync(() => progress?.message("Preparing Prisma 8 project files..."));
|
|
1722
|
-
yield* atCreateStage(runPrismaInit(context, projectDir), "initialize_prisma", "prisma_init_failed");
|
|
1718
|
+
yield* atCreateStage(runPrismaInit(context, projectDir, options.force), "initialize_prisma", "prisma_init_failed");
|
|
1723
1719
|
yield* atCreateStage(Effect.gen(function* () {
|
|
1724
1720
|
yield* scaffoldCreateSharedTemplatesEffect({
|
|
1725
1721
|
projectDir,
|
|
@@ -2038,6 +2034,7 @@ const executeCreateContext = Effect.fn("Create.execute")(function* (context) {
|
|
|
2038
2034
|
template: context.template,
|
|
2039
2035
|
createdProjectPath: context.targetDirectory,
|
|
2040
2036
|
includeDevNextStep: true,
|
|
2037
|
+
force: context.force,
|
|
2041
2038
|
initializeGit: !context.targetPathState.exists || context.targetPathState.isEmptyDirectory,
|
|
2042
2039
|
progressSpinner: createSpinner
|
|
2043
2040
|
});
|