@cedarjs/cli 6.0.0-canary.2935 → 6.0.0-canary.2937
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.
|
@@ -7,15 +7,25 @@ function builder(yargs) {
|
|
|
7
7
|
default: false,
|
|
8
8
|
description: "Overwrite existing DATABASE_URL in .env",
|
|
9
9
|
type: "boolean"
|
|
10
|
+
}).option("migrations", {
|
|
11
|
+
description: "Run Prisma migrations after setup. Omit to be prompted. Use --no-migrations to skip.",
|
|
12
|
+
type: "boolean"
|
|
13
|
+
}).option("verbose", {
|
|
14
|
+
alias: "v",
|
|
15
|
+
default: false,
|
|
16
|
+
description: "Show full output from migration commands (stderr visible in terminal)",
|
|
17
|
+
type: "boolean"
|
|
10
18
|
});
|
|
11
19
|
}
|
|
12
|
-
async function handler({ force }) {
|
|
20
|
+
async function handler({ force, migrations, verbose }) {
|
|
13
21
|
recordTelemetryAttributes({
|
|
14
22
|
command: "setup neon",
|
|
15
|
-
force
|
|
23
|
+
force,
|
|
24
|
+
migrations,
|
|
25
|
+
verbose
|
|
16
26
|
});
|
|
17
27
|
const { handler: handler2 } = await import("./neonHandler.js");
|
|
18
|
-
return handler2({ force });
|
|
28
|
+
return handler2({ force, migrations, verbose });
|
|
19
29
|
}
|
|
20
30
|
export {
|
|
21
31
|
builder,
|
|
@@ -2,6 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import execa from "execa";
|
|
4
4
|
import { Listr } from "listr2";
|
|
5
|
+
import prompts from "prompts";
|
|
5
6
|
import { colors, getPaths, installPackages } from "@cedarjs/cli-helpers";
|
|
6
7
|
import { prettyPrintCedarCommand } from "@cedarjs/cli-helpers/packageManager";
|
|
7
8
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
@@ -25,7 +26,7 @@ function isPostgresConnectionString(rawValue) {
|
|
|
25
26
|
return false;
|
|
26
27
|
}
|
|
27
28
|
}
|
|
28
|
-
async function handler({ force }) {
|
|
29
|
+
async function handler({ force, migrations, verbose }) {
|
|
29
30
|
const cedarPaths = getPaths();
|
|
30
31
|
const shape = checkProjectShape(cedarPaths);
|
|
31
32
|
if (!shape.ok) {
|
|
@@ -51,6 +52,29 @@ async function handler({ force }) {
|
|
|
51
52
|
)
|
|
52
53
|
);
|
|
53
54
|
}
|
|
55
|
+
let runMigrations = migrations;
|
|
56
|
+
if (!skipProvisioning && runMigrations === void 0) {
|
|
57
|
+
if (!process.stdin.isTTY) {
|
|
58
|
+
const error = new Error(
|
|
59
|
+
"Cannot prompt for confirmation in a non-interactive terminal. Please pass --migrations or --no-migrations explicitly."
|
|
60
|
+
);
|
|
61
|
+
errorTelemetry(process.argv, error.message);
|
|
62
|
+
console.error(colors.error(error.message));
|
|
63
|
+
process.exit(1);
|
|
64
|
+
}
|
|
65
|
+
const response = await prompts({
|
|
66
|
+
type: "toggle",
|
|
67
|
+
name: "runMigrations",
|
|
68
|
+
message: "Run Prisma migrations now?",
|
|
69
|
+
initial: true,
|
|
70
|
+
active: "Yes",
|
|
71
|
+
inactive: "No"
|
|
72
|
+
});
|
|
73
|
+
if (response.runMigrations === void 0) {
|
|
74
|
+
process.exit(0);
|
|
75
|
+
}
|
|
76
|
+
runMigrations = response.runMigrations;
|
|
77
|
+
}
|
|
54
78
|
const tasks = new Listr(
|
|
55
79
|
[
|
|
56
80
|
...getSqliteToPostgresTasks({ dbPath: shape.dbPath }),
|
|
@@ -124,6 +148,9 @@ async function handler({ force }) {
|
|
|
124
148
|
if (skipProvisioning) {
|
|
125
149
|
return true;
|
|
126
150
|
}
|
|
151
|
+
if (!runMigrations) {
|
|
152
|
+
return migrations === false ? "Skipped (--no-migrations)" : "Skipped";
|
|
153
|
+
}
|
|
127
154
|
if (ctx.directDatabaseUrlNotSet) {
|
|
128
155
|
return `Skipping migrations \u2014 could not confirm prisma.config is reading DIRECT_DATABASE_URL, so migrations could target the wrong database. Fix datasource.url, then run \`${prettyPrintCedarCommand(["prisma", "migrate", "dev"])}\` manually.`;
|
|
129
156
|
}
|
|
@@ -134,7 +161,7 @@ async function handler({ force }) {
|
|
|
134
161
|
"yarn cedar prisma migrate dev --name init-neon",
|
|
135
162
|
{
|
|
136
163
|
cwd: cedarPaths.base,
|
|
137
|
-
stdio: ["inherit", "inherit", "pipe"],
|
|
164
|
+
stdio: verbose ? "inherit" : ["inherit", "inherit", "pipe"],
|
|
138
165
|
reject: false,
|
|
139
166
|
env: {
|
|
140
167
|
...process.env,
|
|
@@ -144,7 +171,8 @@ async function handler({ force }) {
|
|
|
144
171
|
);
|
|
145
172
|
if (result.exitCode !== 0) {
|
|
146
173
|
throw new Error(
|
|
147
|
-
|
|
174
|
+
verbose ? `Prisma migration failed. You can try running it manually:
|
|
175
|
+
${prettyPrintCedarCommand(["prisma", "migrate", "dev", "--name", "init-neon"])}` : "Prisma migration failed:\n\n" + result.stderr + `
|
|
148
176
|
|
|
149
177
|
You can try running it manually:
|
|
150
178
|
${prettyPrintCedarCommand(["prisma", "migrate", "dev", "--name", "init-neon"])}`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "6.0.0-canary.
|
|
3
|
+
"version": "6.0.0-canary.2937",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -36,17 +36,17 @@
|
|
|
36
36
|
"@babel/preset-typescript": "7.29.7",
|
|
37
37
|
"@babel/traverse": "7.29.7",
|
|
38
38
|
"@babel/types": "7.29.7",
|
|
39
|
-
"@cedarjs/api-server": "6.0.0-canary.
|
|
40
|
-
"@cedarjs/babel-config": "6.0.0-canary.
|
|
41
|
-
"@cedarjs/cli-helpers": "6.0.0-canary.
|
|
42
|
-
"@cedarjs/internal": "6.0.0-canary.
|
|
43
|
-
"@cedarjs/prerender": "6.0.0-canary.
|
|
44
|
-
"@cedarjs/project-config": "6.0.0-canary.
|
|
45
|
-
"@cedarjs/structure": "6.0.0-canary.
|
|
46
|
-
"@cedarjs/telemetry": "6.0.0-canary.
|
|
47
|
-
"@cedarjs/utils": "6.0.0-canary.
|
|
48
|
-
"@cedarjs/vite": "6.0.0-canary.
|
|
49
|
-
"@cedarjs/web-server": "6.0.0-canary.
|
|
39
|
+
"@cedarjs/api-server": "6.0.0-canary.2937",
|
|
40
|
+
"@cedarjs/babel-config": "6.0.0-canary.2937",
|
|
41
|
+
"@cedarjs/cli-helpers": "6.0.0-canary.2937",
|
|
42
|
+
"@cedarjs/internal": "6.0.0-canary.2937",
|
|
43
|
+
"@cedarjs/prerender": "6.0.0-canary.2937",
|
|
44
|
+
"@cedarjs/project-config": "6.0.0-canary.2937",
|
|
45
|
+
"@cedarjs/structure": "6.0.0-canary.2937",
|
|
46
|
+
"@cedarjs/telemetry": "6.0.0-canary.2937",
|
|
47
|
+
"@cedarjs/utils": "6.0.0-canary.2937",
|
|
48
|
+
"@cedarjs/vite": "6.0.0-canary.2937",
|
|
49
|
+
"@cedarjs/web-server": "6.0.0-canary.2937",
|
|
50
50
|
"@listr2/prompt-adapter-enquirer": "4.3.0",
|
|
51
51
|
"@opentelemetry/api": "1.9.1",
|
|
52
52
|
"@opentelemetry/core": "1.30.1",
|
|
@@ -94,7 +94,7 @@
|
|
|
94
94
|
"yargs": "17.7.3"
|
|
95
95
|
},
|
|
96
96
|
"devDependencies": {
|
|
97
|
-
"@cedarjs/framework-tools": "6.0.0-canary.
|
|
97
|
+
"@cedarjs/framework-tools": "6.0.0-canary.2937",
|
|
98
98
|
"@prisma/dmmf": "7.8.0",
|
|
99
99
|
"@types/archiver": "^7.0.0",
|
|
100
100
|
"memfs": "4.68.1",
|