@cedarjs/cli 6.0.0-canary.2874 → 6.0.0-canary.2877
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/dist/commands/setup/neon/neonHandler.js +23 -10
- package/package.json +13 -13
|
@@ -9,6 +9,22 @@ import {
|
|
|
9
9
|
checkProjectShape,
|
|
10
10
|
getSqliteToPostgresTasks
|
|
11
11
|
} from "../database/postgresHandler.js";
|
|
12
|
+
function isPostgresConnectionString(rawValue) {
|
|
13
|
+
let value = rawValue.trim();
|
|
14
|
+
const quoted = value.match(/^(['"])(.*)\1$/);
|
|
15
|
+
if (quoted) {
|
|
16
|
+
value = quoted[2];
|
|
17
|
+
}
|
|
18
|
+
if (!value) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
try {
|
|
22
|
+
const url = new URL(value);
|
|
23
|
+
return (url.protocol === "postgres:" || url.protocol === "postgresql:") && !!url.hostname;
|
|
24
|
+
} catch {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
12
28
|
async function handler({ force }) {
|
|
13
29
|
const cedarPaths = getPaths();
|
|
14
30
|
const shape = checkProjectShape(cedarPaths);
|
|
@@ -23,9 +39,8 @@ async function handler({ force }) {
|
|
|
23
39
|
const envPath = path.join(cedarPaths.base, ".env");
|
|
24
40
|
let hasExistingDatabaseUrl = false;
|
|
25
41
|
if (fs.existsSync(envPath)) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
);
|
|
42
|
+
const match = fs.readFileSync(envPath, "utf-8").match(/^DATABASE_URL=(.*)$/m);
|
|
43
|
+
hasExistingDatabaseUrl = !!match?.[1] && isPostgresConnectionString(match[1]);
|
|
29
44
|
}
|
|
30
45
|
const skipProvisioning = hasExistingDatabaseUrl && !force;
|
|
31
46
|
const notes = [];
|
|
@@ -152,13 +167,11 @@ You can try running it manually:
|
|
|
152
167
|
let envContent = "";
|
|
153
168
|
if (fs.existsSync(envPath)) {
|
|
154
169
|
envContent = fs.readFileSync(envPath, "utf-8");
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
envContent = filtered.join("\n").trimEnd();
|
|
161
|
-
}
|
|
170
|
+
const lines = envContent.split("\n");
|
|
171
|
+
const filtered = lines.filter(
|
|
172
|
+
(line) => !line.startsWith("DATABASE_URL=") && !line.startsWith("DIRECT_DATABASE_URL=")
|
|
173
|
+
);
|
|
174
|
+
envContent = filtered.join("\n").trimEnd();
|
|
162
175
|
if (envContent && !envContent.endsWith("\n")) {
|
|
163
176
|
envContent += "\n";
|
|
164
177
|
}
|
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.2877",
|
|
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.2877",
|
|
40
|
+
"@cedarjs/babel-config": "6.0.0-canary.2877",
|
|
41
|
+
"@cedarjs/cli-helpers": "6.0.0-canary.2877",
|
|
42
|
+
"@cedarjs/internal": "6.0.0-canary.2877",
|
|
43
|
+
"@cedarjs/prerender": "6.0.0-canary.2877",
|
|
44
|
+
"@cedarjs/project-config": "6.0.0-canary.2877",
|
|
45
|
+
"@cedarjs/structure": "6.0.0-canary.2877",
|
|
46
|
+
"@cedarjs/telemetry": "6.0.0-canary.2877",
|
|
47
|
+
"@cedarjs/utils": "6.0.0-canary.2877",
|
|
48
|
+
"@cedarjs/vite": "6.0.0-canary.2877",
|
|
49
|
+
"@cedarjs/web-server": "6.0.0-canary.2877",
|
|
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.2877",
|
|
98
98
|
"@prisma/dmmf": "7.8.0",
|
|
99
99
|
"@types/archiver": "^7.0.0",
|
|
100
100
|
"memfs": "4.64.0",
|