create-prisma 0.11.6 → 0.11.7-pr.95.325.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`: 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.
|
|
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. A non-empty standard `migrations` path is protected: use a new directory for a fresh starter, or continue working in the existing project with the Prisma CLI. Custom migration paths are not detected.
|
|
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-C5IcKO0L.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-C5IcKO0L.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.7-pr.95.325.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", "Overwrite generated starter and Prisma files
|
|
20
|
+
force: optionalBoolean("force", "Overwrite generated starter and Prisma files; refuses a non-empty migrations path"),
|
|
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)")
|
|
@@ -38,6 +38,7 @@ const CreateFailureReasonSchema = Schema.Literals([
|
|
|
38
38
|
"invalid_project_name",
|
|
39
39
|
"target_path_not_directory",
|
|
40
40
|
"target_directory_not_empty",
|
|
41
|
+
"target_has_migrations",
|
|
41
42
|
"unsupported_configuration",
|
|
42
43
|
"template_scaffold_failed",
|
|
43
44
|
"prisma_init_failed",
|
|
@@ -309,20 +310,14 @@ const applicationRuntime = ManagedRuntime.make(ApplicationLayer);
|
|
|
309
310
|
|
|
310
311
|
//#endregion
|
|
311
312
|
//#region src/telemetry/client.ts
|
|
312
|
-
const TELEMETRY_API_KEY = "
|
|
313
|
+
const TELEMETRY_API_KEY = "";
|
|
313
314
|
const TELEMETRY_HOST = "https://us.i.posthog.com";
|
|
314
315
|
const TELEMETRY_CONFIG_FILE = "telemetry.json";
|
|
315
316
|
const TELEMETRY_TIMEOUT_MS = 2e3;
|
|
316
317
|
const AnonymousId = Schema.String.check(Schema.isUUID(4));
|
|
317
318
|
const decodeAnonymousId = Schema.decodeUnknownExit(AnonymousId);
|
|
318
|
-
const isTruthyEnvValue = (value) => [
|
|
319
|
-
"1",
|
|
320
|
-
"true",
|
|
321
|
-
"yes",
|
|
322
|
-
"on"
|
|
323
|
-
].includes(String(value ?? "").trim().toLowerCase());
|
|
324
319
|
function shouldDisableTelemetry() {
|
|
325
|
-
return
|
|
320
|
+
return true;
|
|
326
321
|
}
|
|
327
322
|
function getTelemetryConfigDir() {
|
|
328
323
|
if (process.platform === "darwin") return path.join(os.homedir(), "Library", "Application Support", "create-prisma");
|
|
@@ -345,7 +340,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
|
|
|
345
340
|
return anonymousId;
|
|
346
341
|
});
|
|
347
342
|
const getCommonProperties = () => ({
|
|
348
|
-
"cli-version": "0.11.
|
|
343
|
+
"cli-version": "0.11.7-pr.95.325.1",
|
|
349
344
|
"node-version": process.version,
|
|
350
345
|
platform: process.platform,
|
|
351
346
|
arch: process.arch
|
|
@@ -387,6 +382,7 @@ const expectedRejectionReasons = new Set([
|
|
|
387
382
|
"invalid_project_name",
|
|
388
383
|
"target_path_not_directory",
|
|
389
384
|
"target_directory_not_empty",
|
|
385
|
+
"target_has_migrations",
|
|
390
386
|
"unsupported_configuration",
|
|
391
387
|
"not_authenticated",
|
|
392
388
|
"workspace_missing",
|
|
@@ -1984,6 +1980,19 @@ const collectCreateContext = Effect.fn("Create.collectContext")(function* (input
|
|
|
1984
1980
|
errorReported: true
|
|
1985
1981
|
});
|
|
1986
1982
|
}
|
|
1983
|
+
if (force && targetPathState.exists) {
|
|
1984
|
+
const migrations = yield* inspectTargetPath(path.join(targetDirectory, "migrations"));
|
|
1985
|
+
if (migrations.exists && !migrations.isEmptyDirectory) {
|
|
1986
|
+
const message = `Target directory ${formatPathForDisplay(targetDirectory)} contains migration history. Create a starter in a new directory, or continue working in the existing project with the Prisma CLI. --force cannot overwrite a project with existing migrations.`;
|
|
1987
|
+
yield* Effect.sync(() => cancel(message, { output }));
|
|
1988
|
+
return yield* new CreateFailure({
|
|
1989
|
+
stage: "collect_context",
|
|
1990
|
+
reason: "target_has_migrations",
|
|
1991
|
+
message,
|
|
1992
|
+
errorReported: true
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1987
1996
|
const prismaSetupContext = yield* collectPrismaSetupContextEffect(input, {
|
|
1988
1997
|
projectDir: targetDirectory,
|
|
1989
1998
|
template
|
package/package.json
CHANGED