@cedarjs/cli 6.0.0-rc.241 → 6.0.0-rc.260
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/generate/package/packageHandler.js +4 -1
- package/dist/commands/setup/monitoring/sentry/sentryHandler.js +9 -4
- package/dist/commands/setup/neon/neonHandler.js +23 -10
- package/dist/commands/setup/ui/libraries/chakra-uiHandler.js +3 -1
- package/dist/commands/setup/ui/libraries/mantineHandler.js +3 -1
- package/dist/lib/extendFile.js +1 -1
- package/package.json +13 -13
|
@@ -15,7 +15,7 @@ import { getConfig } from "@cedarjs/project-config";
|
|
|
15
15
|
import { getPackageManager } from "@cedarjs/project-config/packageManager";
|
|
16
16
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
17
17
|
import { getPaths, writeFilesTask } from "../../../lib/index.js";
|
|
18
|
-
import { prepareForRollback } from "../../../lib/rollback.js";
|
|
18
|
+
import { addFileToRollback, prepareForRollback } from "../../../lib/rollback.js";
|
|
19
19
|
import { files } from "./filesTask.js";
|
|
20
20
|
function nameVariants(nameArg) {
|
|
21
21
|
const base = path.basename(getPaths().base);
|
|
@@ -246,6 +246,9 @@ function updateWorkspaceTsconfigReferences(task, folderName, targetWorkspaces) {
|
|
|
246
246
|
async function installAndBuild(folderName) {
|
|
247
247
|
const packagePath = path.join("packages", folderName);
|
|
248
248
|
await installPackages({ stdio: "inherit", cwd: getPaths().base });
|
|
249
|
+
addFileToRollback(
|
|
250
|
+
path.join(getPaths().base, packagePath, "tsconfig.tsbuildinfo")
|
|
251
|
+
);
|
|
249
252
|
await runScript("build", [], { stdio: "inherit", cwd: packagePath });
|
|
250
253
|
}
|
|
251
254
|
const handler = async ({
|
|
@@ -90,15 +90,20 @@ const handler = async ({ force }) => {
|
|
|
90
90
|
title: "Replacing Redwood's Error boundary",
|
|
91
91
|
task: async () => {
|
|
92
92
|
const contentLines = fs.readFileSync(rwPaths.web.app).toString().split("\n");
|
|
93
|
+
const webImportRe = /^import \{ FatalErrorBoundary, ((?:Cedar|Redwood)Provider) \} from '@cedarjs\/web'$/;
|
|
93
94
|
const webImportIndex = contentLines.findLastIndex(
|
|
94
|
-
(line) =>
|
|
95
|
-
line
|
|
96
|
-
)
|
|
95
|
+
(line) => webImportRe.test(line)
|
|
97
96
|
);
|
|
97
|
+
if (webImportIndex === -1) {
|
|
98
|
+
throw new Error(
|
|
99
|
+
`Could not find "import { FatalErrorBoundary, CedarProvider } from '@cedarjs/web'" in web/src/App`
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
const providerName = contentLines[webImportIndex].match(webImportRe)?.[1];
|
|
98
103
|
contentLines.splice(
|
|
99
104
|
webImportIndex,
|
|
100
105
|
1,
|
|
101
|
-
|
|
106
|
+
`import { ${providerName} } from '@cedarjs/web'`
|
|
102
107
|
);
|
|
103
108
|
const boundaryOpenIndex = contentLines.findLastIndex(
|
|
104
109
|
(line) => line.includes("<FatalErrorBoundary page={FatalErrorPage}>")
|
|
@@ -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
|
}
|
|
@@ -54,7 +54,9 @@ async function handler({
|
|
|
54
54
|
insertComponent: {
|
|
55
55
|
name: "ChakraProvider",
|
|
56
56
|
props: { theme: "extendedTheme" },
|
|
57
|
-
|
|
57
|
+
// Older projects (created before CedarProvider replaced the
|
|
58
|
+
// deprecated RedwoodProvider) may still use RedwoodProvider.
|
|
59
|
+
within: "CedarProvider|RedwoodProvider",
|
|
58
60
|
insertBefore: "<ColorModeScript />"
|
|
59
61
|
},
|
|
60
62
|
imports: [
|
|
@@ -77,7 +77,9 @@ async function handler({
|
|
|
77
77
|
insertComponent: {
|
|
78
78
|
name: "MantineProvider",
|
|
79
79
|
props: { theme: "theme" },
|
|
80
|
-
|
|
80
|
+
// Older projects (created before CedarProvider replaced the
|
|
81
|
+
// deprecated RedwoodProvider) may still use RedwoodProvider.
|
|
82
|
+
within: "CedarProvider|RedwoodProvider"
|
|
81
83
|
},
|
|
82
84
|
imports: [
|
|
83
85
|
"import { MantineProvider } from '@mantine/core'",
|
package/dist/lib/extendFile.js
CHANGED
|
@@ -56,7 +56,7 @@ function insertComponent(content, {
|
|
|
56
56
|
"Exactly one of (around | within) must be defined. Choose one."
|
|
57
57
|
);
|
|
58
58
|
}
|
|
59
|
-
const target = around ?? within
|
|
59
|
+
const target = `(?:${around ?? within})`;
|
|
60
60
|
const findTagIndex = (regex) => content.findIndex((line) => regex.test(line));
|
|
61
61
|
let open = findTagIndex(new RegExp(`([^\\S\r
|
|
62
62
|
]*)<${target}\\s*(.*)\\s*>`));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "6.0.0-rc.
|
|
3
|
+
"version": "6.0.0-rc.260",
|
|
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-rc.
|
|
40
|
-
"@cedarjs/babel-config": "6.0.0-rc.
|
|
41
|
-
"@cedarjs/cli-helpers": "6.0.0-rc.
|
|
42
|
-
"@cedarjs/internal": "6.0.0-rc.
|
|
43
|
-
"@cedarjs/prerender": "6.0.0-rc.
|
|
44
|
-
"@cedarjs/project-config": "6.0.0-rc.
|
|
45
|
-
"@cedarjs/structure": "6.0.0-rc.
|
|
46
|
-
"@cedarjs/telemetry": "6.0.0-rc.
|
|
47
|
-
"@cedarjs/utils": "6.0.0-rc.
|
|
48
|
-
"@cedarjs/vite": "6.0.0-rc.
|
|
49
|
-
"@cedarjs/web-server": "6.0.0-rc.
|
|
39
|
+
"@cedarjs/api-server": "6.0.0-rc.260",
|
|
40
|
+
"@cedarjs/babel-config": "6.0.0-rc.260",
|
|
41
|
+
"@cedarjs/cli-helpers": "6.0.0-rc.260",
|
|
42
|
+
"@cedarjs/internal": "6.0.0-rc.260",
|
|
43
|
+
"@cedarjs/prerender": "6.0.0-rc.260",
|
|
44
|
+
"@cedarjs/project-config": "6.0.0-rc.260",
|
|
45
|
+
"@cedarjs/structure": "6.0.0-rc.260",
|
|
46
|
+
"@cedarjs/telemetry": "6.0.0-rc.260",
|
|
47
|
+
"@cedarjs/utils": "6.0.0-rc.260",
|
|
48
|
+
"@cedarjs/vite": "6.0.0-rc.260",
|
|
49
|
+
"@cedarjs/web-server": "6.0.0-rc.260",
|
|
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-rc.
|
|
97
|
+
"@cedarjs/framework-tools": "6.0.0-rc.260",
|
|
98
98
|
"@prisma/dmmf": "7.8.0",
|
|
99
99
|
"@types/archiver": "^7.0.0",
|
|
100
100
|
"memfs": "4.64.0",
|