@cedarjs/cli 2.4.1 → 2.4.2-next.143
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 +6 -2
- package/dist/commands/deploy/baremetal/baremetalHandler.js +4 -4
- package/dist/commands/deploy/serverlessHandler.js +1 -1
- package/dist/commands/dev/devHandler.js +31 -2
- package/dist/commands/experimental/setupOpentelemetryHandler.js +7 -6
- package/dist/commands/experimental/setupReactCompilerHandler.js +10 -9
- package/dist/commands/experimental/setupRscHandler.js +9 -9
- package/dist/commands/experimental/setupStreamingSsrHandler.js +9 -9
- package/dist/commands/generate/package/package.js +15 -2
- package/dist/commands/generate/package/packageHandler.js +297 -19
- package/dist/commands/generate/package/templates/tsconfig.json.template +2 -2
- package/dist/commands/generate/service/serviceHandler.js +5 -2
- package/dist/commands/generate/yargsCommandHelpers.js +16 -14
- package/dist/commands/info.js +6 -3
- package/dist/commands/setup/deploy/helpers/index.js +14 -18
- package/dist/commands/setup/deploy/providers/coherenceHandler.js +33 -34
- package/dist/commands/setup/deploy/providers/serverlessHandler.js +8 -7
- package/dist/commands/setup/deploy/templates/netlify.js +2 -2
- package/dist/commands/setup/docker/dockerHandler.js +5 -4
- package/dist/commands/setup/docker/templates/Dockerfile +3 -3
- package/dist/commands/setup/monitoring/sentry/sentryHandler.js +4 -1
- package/dist/commands/setup/monitoring/sentry/templates/sentryWeb.ts.template +2 -2
- package/dist/commands/upgrade/preUpgradeScripts.js +7 -3
- package/dist/commands/upgrade/upgradeHandler.js +1 -1
- package/dist/index.js +13 -9
- package/dist/lib/index.js +5 -2
- package/dist/lib/plugin.js +1 -1
- package/package.json +27 -26
|
@@ -6,14 +6,15 @@ import * as toml from "smol-toml";
|
|
|
6
6
|
import {
|
|
7
7
|
colors as c,
|
|
8
8
|
getPaths,
|
|
9
|
-
isTypeScriptProject
|
|
9
|
+
isTypeScriptProject,
|
|
10
|
+
getConfigPath
|
|
10
11
|
} from "@cedarjs/cli-helpers";
|
|
11
12
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
12
13
|
import { printSetupNotes } from "../../../../lib/index.js";
|
|
13
14
|
import { serverFileExists } from "../../../../lib/project.js";
|
|
14
15
|
import { addFilesTask } from "../helpers/index.js";
|
|
15
16
|
const { getSchemaWithPath, getConfig } = prismaInternals;
|
|
16
|
-
const
|
|
17
|
+
const cedarPaths = getPaths();
|
|
17
18
|
const EXTENSION = isTypeScriptProject ? "ts" : "js";
|
|
18
19
|
async function handler({ force }) {
|
|
19
20
|
try {
|
|
@@ -21,12 +22,12 @@ async function handler({ force }) {
|
|
|
21
22
|
const tasks = new Listr(
|
|
22
23
|
[
|
|
23
24
|
addCoherenceFilesTask,
|
|
24
|
-
|
|
25
|
+
updateConfigTomlTask(),
|
|
25
26
|
printSetupNotes([
|
|
26
27
|
"You're ready to deploy to Coherence! \u2728\n",
|
|
27
28
|
"Go to https://app.withcoherence.com to create your account and setup your cloud or GitHub connections.",
|
|
28
29
|
"Check out the deployment docs at https://docs.withcoherence.com for detailed instructions and more information.\n",
|
|
29
|
-
"Reach out to
|
|
30
|
+
"Reach out to cedar@withcoherence.com with any questions! We're here to support you."
|
|
30
31
|
])
|
|
31
32
|
],
|
|
32
33
|
{ rendererOptions: { collapse: false } }
|
|
@@ -41,12 +42,12 @@ async function handler({ force }) {
|
|
|
41
42
|
async function getAddCoherenceFilesTask(force) {
|
|
42
43
|
const files = [
|
|
43
44
|
{
|
|
44
|
-
path: path.join(
|
|
45
|
+
path: path.join(cedarPaths.api.functions, `health.${EXTENSION}`),
|
|
45
46
|
content: coherenceFiles.healthCheck
|
|
46
47
|
}
|
|
47
48
|
];
|
|
48
49
|
const coherenceConfigFile = {
|
|
49
|
-
path: path.join(
|
|
50
|
+
path: path.join(cedarPaths.base, "coherence.yml")
|
|
50
51
|
};
|
|
51
52
|
coherenceConfigFile.content = await getCoherenceConfigFileContent();
|
|
52
53
|
files.push(coherenceConfigFile);
|
|
@@ -57,7 +58,7 @@ async function getAddCoherenceFilesTask(force) {
|
|
|
57
58
|
});
|
|
58
59
|
}
|
|
59
60
|
async function getCoherenceConfigFileContent() {
|
|
60
|
-
const result = await getSchemaWithPath(
|
|
61
|
+
const result = await getSchemaWithPath(cedarPaths.api.dbSchema);
|
|
61
62
|
const prismaConfig = await getConfig({ datamodel: result.schemas });
|
|
62
63
|
let db = prismaConfig.datasources[0].activeProvider;
|
|
63
64
|
if (!SUPPORTED_DATABASES.includes(db)) {
|
|
@@ -73,7 +74,7 @@ async function getCoherenceConfigFileContent() {
|
|
|
73
74
|
if (db === "postgresql") {
|
|
74
75
|
db = "postgres";
|
|
75
76
|
}
|
|
76
|
-
const apiProdCommand = ["yarn", "
|
|
77
|
+
const apiProdCommand = ["yarn", "cedar", "build", "api", "&&"];
|
|
77
78
|
if (serverFileExists()) {
|
|
78
79
|
apiProdCommand.push(
|
|
79
80
|
"yarn",
|
|
@@ -82,7 +83,7 @@ async function getCoherenceConfigFileContent() {
|
|
|
82
83
|
"--apiRootPath=/api"
|
|
83
84
|
);
|
|
84
85
|
} else {
|
|
85
|
-
apiProdCommand.push("yarn", "
|
|
86
|
+
apiProdCommand.push("yarn", "cedar", "serve", "api", "--apiRootPath=/api");
|
|
86
87
|
}
|
|
87
88
|
return coherenceFiles.yamlTemplate({
|
|
88
89
|
db,
|
|
@@ -90,45 +91,43 @@ async function getCoherenceConfigFileContent() {
|
|
|
90
91
|
});
|
|
91
92
|
}
|
|
92
93
|
const SUPPORTED_DATABASES = ["mysql", "postgresql"];
|
|
93
|
-
function
|
|
94
|
+
function updateConfigTomlTask() {
|
|
95
|
+
const configTomlPath = getConfigPath();
|
|
96
|
+
const configFileName = path.basename(configTomlPath);
|
|
94
97
|
return {
|
|
95
|
-
title:
|
|
98
|
+
title: `Updating ${configFileName}...`,
|
|
96
99
|
task: () => {
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const redwoodTOMLObject = toml.parse(redwoodTOMLContent);
|
|
103
|
-
if (!redwoodTOMLObject.web.host) {
|
|
104
|
-
const [beforeWeb, afterWeb] = redwoodTOMLContent.split(/\[web\]\s/);
|
|
105
|
-
redwoodTOMLContent = [
|
|
100
|
+
let configContent = fs.readFileSync(configTomlPath, "utf-8");
|
|
101
|
+
const configObject = toml.parse(configContent);
|
|
102
|
+
if (!configObject.web.host) {
|
|
103
|
+
const [beforeWeb, afterWeb] = configContent.split(/\[web\]\s/);
|
|
104
|
+
configContent = [
|
|
106
105
|
beforeWeb,
|
|
107
106
|
'[web]\n host = "0.0.0.0"\n',
|
|
108
107
|
afterWeb
|
|
109
108
|
].join("");
|
|
110
109
|
}
|
|
111
|
-
if (!
|
|
112
|
-
const [beforeApi, afterApi] =
|
|
113
|
-
|
|
110
|
+
if (!configObject.api.host) {
|
|
111
|
+
const [beforeApi, afterApi] = configContent.split(/\[api\]\s/);
|
|
112
|
+
configContent = [
|
|
114
113
|
beforeApi,
|
|
115
114
|
'[api]\n host = "0.0.0.0"\n',
|
|
116
115
|
afterApi
|
|
117
116
|
].join("");
|
|
118
117
|
}
|
|
119
|
-
|
|
118
|
+
configContent = configContent.replaceAll(
|
|
120
119
|
HOST_REGEXP,
|
|
121
120
|
(match, spaceBeforeAssign, spaceAfterAssign) => ["host", spaceBeforeAssign, "=", spaceAfterAssign, '"0.0.0.0"'].join(
|
|
122
121
|
""
|
|
123
122
|
)
|
|
124
123
|
);
|
|
125
|
-
|
|
124
|
+
configContent = configContent.replace(
|
|
126
125
|
API_URL_REGEXP,
|
|
127
126
|
(match, spaceBeforeAssign, spaceAfterAssign) => ["apiUrl", spaceBeforeAssign, "=", spaceAfterAssign, '"/api"'].join(
|
|
128
127
|
""
|
|
129
128
|
)
|
|
130
129
|
);
|
|
131
|
-
|
|
130
|
+
configContent = configContent.replaceAll(
|
|
132
131
|
PORT_REGEXP,
|
|
133
132
|
(_match, spaceBeforeAssign, spaceAfterAssign, port) => [
|
|
134
133
|
"port",
|
|
@@ -138,7 +137,7 @@ function updateRedwoodTOMLTask() {
|
|
|
138
137
|
`"\${PORT:${port}}"`
|
|
139
138
|
].join("")
|
|
140
139
|
);
|
|
141
|
-
fs.writeFileSync(
|
|
140
|
+
fs.writeFileSync(configTomlPath, configContent);
|
|
142
141
|
}
|
|
143
142
|
};
|
|
144
143
|
}
|
|
@@ -153,7 +152,7 @@ const coherenceFiles = {
|
|
|
153
152
|
prod:
|
|
154
153
|
command: ${apiProdCommand}
|
|
155
154
|
dev:
|
|
156
|
-
command: ["yarn", "
|
|
155
|
+
command: ["yarn", "cedar", "build", "api", "&&", "yarn", "cedar", "dev", "api", "--apiRootPath=/api"]
|
|
157
156
|
local_packages: ["node_modules"]
|
|
158
157
|
|
|
159
158
|
system:
|
|
@@ -162,27 +161,27 @@ const coherenceFiles = {
|
|
|
162
161
|
health_check: "/api/health"
|
|
163
162
|
|
|
164
163
|
resources:
|
|
165
|
-
- name: ${path.basename(
|
|
164
|
+
- name: ${path.basename(cedarPaths.base)}-db
|
|
166
165
|
engine: ${db}
|
|
167
166
|
version: 13
|
|
168
167
|
type: database
|
|
169
168
|
${db === "postgres" ? "adapter: postgresql" : ""}
|
|
170
169
|
|
|
171
170
|
# If you use data migrations, use the following instead:
|
|
172
|
-
# migration: ["yarn", "
|
|
173
|
-
migration: ["yarn", "
|
|
171
|
+
# migration: ["yarn", "cedar", "prisma", "migrate", "deploy", "&&", "yarn", "cedar", "data-migrate", "up"]
|
|
172
|
+
migration: ["yarn", "cedar", "prisma", "migrate", "deploy"]
|
|
174
173
|
|
|
175
174
|
web:
|
|
176
175
|
type: frontend
|
|
177
176
|
assets_path: "web/dist"
|
|
178
177
|
prod:
|
|
179
|
-
command: ["yarn", "
|
|
178
|
+
command: ["yarn", "cedar", "serve", "web"]
|
|
180
179
|
dev:
|
|
181
|
-
command: ["yarn", "
|
|
180
|
+
command: ["yarn", "cedar", "dev", "web", "--fwd=\\"--allowed-hosts all\\""]
|
|
182
181
|
|
|
183
182
|
# Heads up: Redwood's prerender doesn't work with Coherence yet.
|
|
184
183
|
# For current status and updates, see https://github.com/redwoodjs/redwood/issues/8333.
|
|
185
|
-
build: ["yarn", "
|
|
184
|
+
build: ["yarn", "cedar", "build", "web", "--no-prerender"]
|
|
186
185
|
local_packages: ["node_modules"]
|
|
187
186
|
|
|
188
187
|
system:
|
|
@@ -2,7 +2,7 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import { Listr } from "listr2";
|
|
4
4
|
import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
5
|
-
import { getSchemaPath } from "@cedarjs/project-config";
|
|
5
|
+
import { getSchemaPath, getConfigPath } from "@cedarjs/project-config";
|
|
6
6
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
7
7
|
import c from "../../../../lib/colors.js";
|
|
8
8
|
import {
|
|
@@ -68,17 +68,18 @@ const prismaBinaryTargetAdditions = async () => {
|
|
|
68
68
|
fs.writeFileSync(schemaPath, result);
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
const
|
|
71
|
+
const updateConfigTomlTask = () => {
|
|
72
|
+
const configTomlPath = getConfigPath();
|
|
73
|
+
const configFileName = path.basename(configTomlPath);
|
|
72
74
|
return {
|
|
73
|
-
title:
|
|
75
|
+
title: `Updating ${configFileName} apiUrl...`,
|
|
74
76
|
task: () => {
|
|
75
|
-
const
|
|
76
|
-
const content = fs.readFileSync(configPath).toString();
|
|
77
|
+
const content = fs.readFileSync(configTomlPath).toString();
|
|
77
78
|
const newContent = content.replace(
|
|
78
79
|
/apiUrl.*?\n/m,
|
|
79
80
|
'apiUrl = "${API_URL:/api}" # Set API_URL in production to the Serverless deploy endpoint of your api service, see https://cedarjs.com/docs/deploy/serverless-deploy\n'
|
|
80
81
|
);
|
|
81
|
-
fs.writeFileSync(
|
|
82
|
+
fs.writeFileSync(configTomlPath, newContent);
|
|
82
83
|
}
|
|
83
84
|
};
|
|
84
85
|
};
|
|
@@ -108,7 +109,7 @@ const handler = async ({ force }) => {
|
|
|
108
109
|
files,
|
|
109
110
|
force
|
|
110
111
|
}),
|
|
111
|
-
|
|
112
|
+
updateConfigTomlTask(),
|
|
112
113
|
addToGitIgnoreTask({
|
|
113
114
|
paths: [".serverless"]
|
|
114
115
|
}),
|
|
@@ -23,9 +23,9 @@ const NETLIFY_TOML = `[build]
|
|
|
23
23
|
# - \`netlify link\` https://cli.netlify.com/commands/link/
|
|
24
24
|
[dev]
|
|
25
25
|
framework = "redwoodjs"
|
|
26
|
-
# Make sure \`targetPort\` matches \`web.port\` in
|
|
26
|
+
# Make sure \`targetPort\` matches \`web.port\` in your cedar.toml file
|
|
27
27
|
targetPort = ${config.web.port}
|
|
28
|
-
# Point your browser to this port to access your app
|
|
28
|
+
# Point your browser to this port to access your app
|
|
29
29
|
port = 8888
|
|
30
30
|
`;
|
|
31
31
|
export {
|
|
@@ -35,6 +35,8 @@ async function handler({ force }) {
|
|
|
35
35
|
"docker-compose.prod.yml"
|
|
36
36
|
);
|
|
37
37
|
const dockerignoreFilePath = path.join(getPaths().base, ".dockerignore");
|
|
38
|
+
const configTomlPath = getConfigPath();
|
|
39
|
+
const configFileName = path.basename(configTomlPath);
|
|
38
40
|
const tasks = new Listr(
|
|
39
41
|
[
|
|
40
42
|
{
|
|
@@ -193,10 +195,9 @@ async function handler({ force }) {
|
|
|
193
195
|
}
|
|
194
196
|
},
|
|
195
197
|
{
|
|
196
|
-
title:
|
|
198
|
+
title: `Adding config to ${configFileName}...`,
|
|
197
199
|
task: () => {
|
|
198
|
-
|
|
199
|
-
let configContent = fs.readFileSync(redwoodTomlPath, "utf-8");
|
|
200
|
+
let configContent = fs.readFileSync(configTomlPath, "utf-8");
|
|
200
201
|
const browserOpenRegExp = /open\s*=\s*true/;
|
|
201
202
|
if (browserOpenRegExp.test(configContent)) {
|
|
202
203
|
configContent = configContent.replace(
|
|
@@ -204,7 +205,7 @@ async function handler({ force }) {
|
|
|
204
205
|
"open = false"
|
|
205
206
|
);
|
|
206
207
|
}
|
|
207
|
-
writeFile(
|
|
208
|
+
writeFile(configTomlPath, configContent, {
|
|
208
209
|
existingFiles: "OVERWRITE"
|
|
209
210
|
});
|
|
210
211
|
}
|
|
@@ -27,7 +27,7 @@ RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,uid=1000 \
|
|
|
27
27
|
--mount=type=cache,target=/home/node/.cache,uid=1000 \
|
|
28
28
|
CI=1 yarn install
|
|
29
29
|
|
|
30
|
-
COPY --chown=node:node redwood.toml
|
|
30
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
31
31
|
COPY --chown=node:node graphql.config.cjs .
|
|
32
32
|
COPY --chown=node:node .env.defaults .env.defaults
|
|
33
33
|
|
|
@@ -82,7 +82,7 @@ RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,uid=1000 \
|
|
|
82
82
|
--mount=type=cache,target=/home/node/.cache,uid=1000 \
|
|
83
83
|
CI=1 yarn workspaces focus api --production
|
|
84
84
|
|
|
85
|
-
COPY --chown=node:node redwood.toml
|
|
85
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
86
86
|
COPY --chown=node:node graphql.config.cjs .
|
|
87
87
|
COPY --chown=node:node .env.defaults .env.defaults
|
|
88
88
|
|
|
@@ -122,7 +122,7 @@ RUN --mount=type=cache,target=/home/node/.yarn/berry/cache,uid=1000 \
|
|
|
122
122
|
--mount=type=cache,target=/home/node/.cache,uid=1000 \
|
|
123
123
|
CI=1 yarn workspaces focus web --production
|
|
124
124
|
|
|
125
|
-
COPY --chown=node:node redwood.toml
|
|
125
|
+
COPY --chown=node:node cedar.toml* redwood.toml* ./
|
|
126
126
|
COPY --chown=node:node graphql.config.cjs .
|
|
127
127
|
COPY --chown=node:node .env.defaults .env.defaults
|
|
128
128
|
|
|
@@ -11,10 +11,13 @@ import {
|
|
|
11
11
|
prettify,
|
|
12
12
|
writeFilesTask
|
|
13
13
|
} from "@cedarjs/cli-helpers";
|
|
14
|
+
import { getConfigPath } from "@cedarjs/project-config";
|
|
14
15
|
import { errorTelemetry } from "@cedarjs/telemetry";
|
|
15
16
|
const rwPaths = getPaths();
|
|
16
17
|
const handler = async ({ force }) => {
|
|
17
18
|
const extension = isTypeScriptProject() ? "ts" : "js";
|
|
19
|
+
const configTomlPath = getConfigPath();
|
|
20
|
+
const configFileName = path.basename(configTomlPath);
|
|
18
21
|
const notes = [];
|
|
19
22
|
const tasks = new Listr([
|
|
20
23
|
addApiPackages(["@envelop/sentry@5", "@sentry/node@7"]),
|
|
@@ -121,7 +124,7 @@ const handler = async ({ force }) => {
|
|
|
121
124
|
task: (ctx) => {
|
|
122
125
|
notes.push(
|
|
123
126
|
colors.important(
|
|
124
|
-
|
|
127
|
+
task.output = `You will need to add \`SENTRY_DSN\` to \`includeEnvironmentVariables\` in ${configFileName}.`
|
|
125
128
|
)
|
|
126
129
|
);
|
|
127
130
|
if (ctx.addEnvelopPluginSkipped) {
|
|
@@ -6,9 +6,9 @@ let environment = 'development'
|
|
|
6
6
|
if (typeof process === 'undefined' || !process.env?.SENTRY_DSN) {
|
|
7
7
|
console.error(
|
|
8
8
|
'Missing SENTRY_DSN environment variable. Did you forget to add it to ' +
|
|
9
|
-
'your redwood.toml
|
|
9
|
+
'your cedar.toml (or redwood.toml) in `includeEnvironmentVariables`?'
|
|
10
10
|
)
|
|
11
|
-
console.info(`Copy this into your redwood.toml file:`)
|
|
11
|
+
console.info(`Copy this into your cedar.toml (or redwood.toml) file:`)
|
|
12
12
|
console.info(`
|
|
13
13
|
includeEnvironmentVariables = [
|
|
14
14
|
"SENTRY_DSN"
|
|
@@ -139,7 +139,7 @@ async function runPreUpgradeScripts(ctx, task, { verbose, force }) {
|
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
141
|
const scriptContent = await fs.promises.readFile(scriptPath, "utf8");
|
|
142
|
-
const deps = extractDependencies(scriptContent);
|
|
142
|
+
const deps = extractDependencies(scriptContent, version);
|
|
143
143
|
if (deps.length > 0) {
|
|
144
144
|
const depList = deps.join(", ");
|
|
145
145
|
task.output = `Installing dependencies for ${scriptName}: ${depList}...`;
|
|
@@ -201,7 +201,7 @@ ${errorOutput}`;
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
}
|
|
204
|
-
const extractDependencies = (content) => {
|
|
204
|
+
const extractDependencies = (content, version) => {
|
|
205
205
|
const deps = /* @__PURE__ */ new Map();
|
|
206
206
|
const commentRegex = /\/\/\s*@dependency:\s*(\S+)/g;
|
|
207
207
|
let match;
|
|
@@ -225,7 +225,11 @@ const extractDependencies = (content) => {
|
|
|
225
225
|
name = parts[0];
|
|
226
226
|
}
|
|
227
227
|
if (!deps.has(name)) {
|
|
228
|
-
|
|
228
|
+
if (version && name.startsWith("@cedarjs/")) {
|
|
229
|
+
deps.set(name, `${name}@${version}`);
|
|
230
|
+
} else {
|
|
231
|
+
deps.set(name, name);
|
|
232
|
+
}
|
|
229
233
|
}
|
|
230
234
|
}
|
|
231
235
|
return Array.from(deps.values());
|
|
@@ -156,7 +156,7 @@ const handler = async ({
|
|
|
156
156
|
const additionalMessages = [];
|
|
157
157
|
if (!getConfig().notifications.versionUpdates.includes(tag) && isValidCedarJSTag(tag)) {
|
|
158
158
|
additionalMessages.push(
|
|
159
|
-
` \u2756 You may want to update your redwood.toml
|
|
159
|
+
` \u2756 You may want to update your cedar.toml (or redwood.toml) so that \`notifications.versionUpdates\` includes "${tag}"
|
|
160
160
|
`
|
|
161
161
|
);
|
|
162
162
|
}
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { trace, SpanStatusCode } from "@opentelemetry/api";
|
|
|
5
5
|
import { hideBin, Parser } from "yargs/helpers";
|
|
6
6
|
import yargs from "yargs/yargs";
|
|
7
7
|
import { loadEnvFiles, recordTelemetryAttributes } from "@cedarjs/cli-helpers";
|
|
8
|
-
import { projectIsEsm } from "@cedarjs/project-config";
|
|
8
|
+
import { projectIsEsm, getConfigPath } from "@cedarjs/project-config";
|
|
9
9
|
import { telemetryMiddleware } from "@cedarjs/telemetry";
|
|
10
10
|
import * as buildCommand from "./commands/build.js";
|
|
11
11
|
import * as checkCommand from "./commands/check.js";
|
|
@@ -49,7 +49,7 @@ cwd ??= process.env.RWJS_CWD;
|
|
|
49
49
|
cwd = getTomlDir(cwd);
|
|
50
50
|
process.env.RWJS_CWD = cwd;
|
|
51
51
|
if (process.argv[1]?.endsWith("redwood.js")) {
|
|
52
|
-
const tomlPath =
|
|
52
|
+
const tomlPath = getConfigPath(cwd);
|
|
53
53
|
const toml = fs.readFileSync(tomlPath, "utf8");
|
|
54
54
|
const disableWarning = /^\s*rwBinWarning\s*=\s*false/m.test(toml);
|
|
55
55
|
if (!disableWarning) {
|
|
@@ -112,7 +112,7 @@ async function runYargs() {
|
|
|
112
112
|
updateCheck.isEnabled() && updateCheck.updateCheckMiddleware
|
|
113
113
|
].filter(Boolean)
|
|
114
114
|
).option("cwd", {
|
|
115
|
-
describe: "Working directory to use (where `redwood.toml` is located)"
|
|
115
|
+
describe: "Working directory to use (where `cedar.toml` or `redwood.toml` is located)"
|
|
116
116
|
}).option("load-env-files", {
|
|
117
117
|
describe: "Load additional .env files. Values defined in files specified later override earlier ones.",
|
|
118
118
|
array: true
|
|
@@ -144,21 +144,25 @@ async function runYargs() {
|
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
function getTomlDir(cwd2) {
|
|
147
|
+
const configFiles = ["cedar.toml", "redwood.toml"];
|
|
147
148
|
let tomlDir = "";
|
|
148
149
|
try {
|
|
149
150
|
if (cwd2) {
|
|
150
|
-
|
|
151
|
-
|
|
151
|
+
const found = configFiles.some((f) => fs.existsSync(path.join(cwd2, f)));
|
|
152
|
+
if (!found) {
|
|
153
|
+
throw new Error(
|
|
154
|
+
`Couldn't find a "cedar.toml" or "redwood.toml" file in ${cwd2}`
|
|
155
|
+
);
|
|
152
156
|
}
|
|
153
157
|
tomlDir = cwd2;
|
|
154
158
|
} else {
|
|
155
|
-
const
|
|
156
|
-
if (!
|
|
159
|
+
const configTomlPath = findUp("cedar.toml", process.cwd()) || findUp("redwood.toml", process.cwd());
|
|
160
|
+
if (!configTomlPath) {
|
|
157
161
|
throw new Error(
|
|
158
|
-
`Couldn't find up a "redwood.toml" file from ${process.cwd()}`
|
|
162
|
+
`Couldn't find up a "cedar.toml" or "redwood.toml" file from ${process.cwd()}`
|
|
159
163
|
);
|
|
160
164
|
}
|
|
161
|
-
tomlDir = path.dirname(
|
|
165
|
+
tomlDir = path.dirname(configTomlPath);
|
|
162
166
|
}
|
|
163
167
|
} catch (error) {
|
|
164
168
|
console.error(error.message);
|
package/dist/lib/index.js
CHANGED
|
@@ -36,7 +36,7 @@ const nameVariants = (name) => {
|
|
|
36
36
|
pluralConstantName: decamelize(pluralize(normalizedName)).toUpperCase()
|
|
37
37
|
};
|
|
38
38
|
};
|
|
39
|
-
const generateTemplate =
|
|
39
|
+
const generateTemplate = (templateFilename, { name, ...rest }) => {
|
|
40
40
|
try {
|
|
41
41
|
const templateFn = template(readFile(templateFilename).toString());
|
|
42
42
|
const renderedTemplate = templateFn({
|
|
@@ -157,7 +157,10 @@ const getConfig = () => {
|
|
|
157
157
|
};
|
|
158
158
|
const getPrettierOptions = async () => {
|
|
159
159
|
try {
|
|
160
|
-
const
|
|
160
|
+
const cjsPath = path.join(getPaths().base, "prettier.config.cjs");
|
|
161
|
+
const mjsPath = path.join(getPaths().base, "prettier.config.mjs");
|
|
162
|
+
const prettierConfigPath = fs.existsSync(cjsPath) ? cjsPath : mjsPath;
|
|
163
|
+
const { default: prettierOptions } = await import(`file://${prettierConfigPath}`);
|
|
161
164
|
return prettierOptions;
|
|
162
165
|
} catch (e) {
|
|
163
166
|
if (process.env.VITEST_POOL_ID !== void 0) {
|
package/dist/lib/plugin.js
CHANGED
|
@@ -108,7 +108,7 @@ function checkPluginListAndWarn(plugins) {
|
|
|
108
108
|
if (pluginPackages.length !== new Set(pluginPackages).size) {
|
|
109
109
|
console.warn(
|
|
110
110
|
ansis.yellow(
|
|
111
|
-
"\u26A0\uFE0F Duplicate plugin packages found in
|
|
111
|
+
"\u26A0\uFE0F Duplicate plugin packages found in your cedar.toml, duplicates will be ignored."
|
|
112
112
|
)
|
|
113
113
|
);
|
|
114
114
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.2-next.143+b69a4494c",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,33 +32,33 @@
|
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/preset-typescript": "7.28.5",
|
|
35
|
-
"@babel/runtime-corejs3": "7.28.
|
|
36
|
-
"@cedarjs/api-server": "2.4.
|
|
37
|
-
"@cedarjs/cli-helpers": "2.4.
|
|
38
|
-
"@cedarjs/fastify-web": "2.4.
|
|
39
|
-
"@cedarjs/internal": "2.4.
|
|
40
|
-
"@cedarjs/prerender": "2.4.
|
|
41
|
-
"@cedarjs/project-config": "2.4.
|
|
42
|
-
"@cedarjs/structure": "2.4.
|
|
43
|
-
"@cedarjs/telemetry": "2.4.
|
|
44
|
-
"@cedarjs/web-server": "2.4.
|
|
35
|
+
"@babel/runtime-corejs3": "7.28.6",
|
|
36
|
+
"@cedarjs/api-server": "2.4.2-next.143+b69a4494c",
|
|
37
|
+
"@cedarjs/cli-helpers": "2.4.2-next.143+b69a4494c",
|
|
38
|
+
"@cedarjs/fastify-web": "2.4.2-next.143+b69a4494c",
|
|
39
|
+
"@cedarjs/internal": "2.4.2-next.143+b69a4494c",
|
|
40
|
+
"@cedarjs/prerender": "2.4.2-next.143+b69a4494c",
|
|
41
|
+
"@cedarjs/project-config": "2.4.2-next.143+b69a4494c",
|
|
42
|
+
"@cedarjs/structure": "2.4.2-next.143+b69a4494c",
|
|
43
|
+
"@cedarjs/telemetry": "2.4.2-next.143+b69a4494c",
|
|
44
|
+
"@cedarjs/web-server": "2.4.2-next.143+b69a4494c",
|
|
45
45
|
"@listr2/prompt-adapter-enquirer": "2.0.16",
|
|
46
|
-
"@opentelemetry/api": "1.
|
|
47
|
-
"@opentelemetry/core": "1.
|
|
48
|
-
"@opentelemetry/exporter-trace-otlp-http": "0.
|
|
49
|
-
"@opentelemetry/resources": "1.
|
|
50
|
-
"@opentelemetry/sdk-trace-node": "1.
|
|
51
|
-
"@opentelemetry/semantic-conventions": "1.
|
|
52
|
-
"@prisma/internals": "6.19.
|
|
46
|
+
"@opentelemetry/api": "1.9.0",
|
|
47
|
+
"@opentelemetry/core": "1.30.1",
|
|
48
|
+
"@opentelemetry/exporter-trace-otlp-http": "0.57.2",
|
|
49
|
+
"@opentelemetry/resources": "1.30.1",
|
|
50
|
+
"@opentelemetry/sdk-trace-node": "1.30.1",
|
|
51
|
+
"@opentelemetry/semantic-conventions": "1.38.0",
|
|
52
|
+
"@prisma/internals": "6.19.2",
|
|
53
53
|
"ansis": "4.2.0",
|
|
54
54
|
"archiver": "7.0.1",
|
|
55
55
|
"boxen": "5.1.2",
|
|
56
56
|
"camelcase": "6.3.0",
|
|
57
57
|
"change-case": "4.1.2",
|
|
58
|
-
"ci-info": "4.
|
|
58
|
+
"ci-info": "4.4.0",
|
|
59
59
|
"concurrently": "9.2.1",
|
|
60
60
|
"configstore": "7.1.0",
|
|
61
|
-
"core-js": "3.
|
|
61
|
+
"core-js": "3.48.0",
|
|
62
62
|
"cross-env": "7.0.3",
|
|
63
63
|
"decamelize": "6.0.1",
|
|
64
64
|
"dotenv-defaults": "5.0.2",
|
|
@@ -68,20 +68,21 @@
|
|
|
68
68
|
"fast-glob": "3.3.3",
|
|
69
69
|
"humanize-string": "2.1.0",
|
|
70
70
|
"jscodeshift": "17.0.0",
|
|
71
|
+
"jsonc-parser": "3.3.1",
|
|
71
72
|
"latest-version": "9.0.0",
|
|
72
73
|
"listr2": "7.0.2",
|
|
73
74
|
"lodash": "4.17.21",
|
|
74
75
|
"pascalcase": "1.0.0",
|
|
75
76
|
"pluralize": "8.0.0",
|
|
76
77
|
"portfinder": "1.0.38",
|
|
77
|
-
"prettier": "3.
|
|
78
|
-
"prisma": "6.19.
|
|
78
|
+
"prettier": "3.8.1",
|
|
79
|
+
"prisma": "6.19.2",
|
|
79
80
|
"prompts": "2.4.2",
|
|
80
81
|
"rimraf": "6.1.2",
|
|
81
82
|
"semver": "7.7.3",
|
|
82
83
|
"smol-toml": "1.6.0",
|
|
83
84
|
"string-env-interpolation": "1.0.1",
|
|
84
|
-
"systeminformation": "5.30.
|
|
85
|
+
"systeminformation": "5.30.6",
|
|
85
86
|
"termi-link": "1.1.0",
|
|
86
87
|
"title-case": "3.0.3",
|
|
87
88
|
"unionfs": "4.6.0",
|
|
@@ -90,10 +91,10 @@
|
|
|
90
91
|
"yargs": "17.7.2"
|
|
91
92
|
},
|
|
92
93
|
"devDependencies": {
|
|
93
|
-
"@babel/cli": "7.28.
|
|
94
|
+
"@babel/cli": "7.28.6",
|
|
94
95
|
"@babel/core": "^7.26.10",
|
|
95
96
|
"@types/archiver": "^7.0.0",
|
|
96
|
-
"memfs": "4.
|
|
97
|
+
"memfs": "4.56.10",
|
|
97
98
|
"node-ssh": "13.2.1",
|
|
98
99
|
"ts-dedent": "2.2.0",
|
|
99
100
|
"tsx": "4.21.0",
|
|
@@ -103,5 +104,5 @@
|
|
|
103
104
|
"publishConfig": {
|
|
104
105
|
"access": "public"
|
|
105
106
|
},
|
|
106
|
-
"gitHead": "
|
|
107
|
+
"gitHead": "b69a4494c40b0a4807f6b492ae65d0596f374e8a"
|
|
107
108
|
}
|