create-prisma 0.11.6 → 0.11.7
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-Cow6mEVn.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-Cow6mEVn.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";
|
|
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",
|
|
@@ -345,7 +346,7 @@ const getAnonymousIdEffect = Effect.fn("Telemetry.getAnonymousId")(function* ()
|
|
|
345
346
|
return anonymousId;
|
|
346
347
|
});
|
|
347
348
|
const getCommonProperties = () => ({
|
|
348
|
-
"cli-version": "0.11.
|
|
349
|
+
"cli-version": "0.11.7",
|
|
349
350
|
"node-version": process.version,
|
|
350
351
|
platform: process.platform,
|
|
351
352
|
arch: process.arch
|
|
@@ -387,6 +388,7 @@ const expectedRejectionReasons = new Set([
|
|
|
387
388
|
"invalid_project_name",
|
|
388
389
|
"target_path_not_directory",
|
|
389
390
|
"target_directory_not_empty",
|
|
391
|
+
"target_has_migrations",
|
|
390
392
|
"unsupported_configuration",
|
|
391
393
|
"not_authenticated",
|
|
392
394
|
"workspace_missing",
|
|
@@ -1984,6 +1986,19 @@ const collectCreateContext = Effect.fn("Create.collectContext")(function* (input
|
|
|
1984
1986
|
errorReported: true
|
|
1985
1987
|
});
|
|
1986
1988
|
}
|
|
1989
|
+
if (force && targetPathState.exists) {
|
|
1990
|
+
const migrations = yield* inspectTargetPath(path.join(targetDirectory, "migrations"));
|
|
1991
|
+
if (migrations.exists && !migrations.isEmptyDirectory) {
|
|
1992
|
+
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.`;
|
|
1993
|
+
yield* Effect.sync(() => cancel(message, { output }));
|
|
1994
|
+
return yield* new CreateFailure({
|
|
1995
|
+
stage: "collect_context",
|
|
1996
|
+
reason: "target_has_migrations",
|
|
1997
|
+
message,
|
|
1998
|
+
errorReported: true
|
|
1999
|
+
});
|
|
2000
|
+
}
|
|
2001
|
+
}
|
|
1987
2002
|
const prismaSetupContext = yield* collectPrismaSetupContextEffect(input, {
|
|
1988
2003
|
projectDir: targetDirectory,
|
|
1989
2004
|
template
|