@cedarjs/cli 6.0.0-canary.2930 → 6.0.0-canary.2931
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/dev/devHandler.js +38 -1
- package/dist/commands/dev.js +3 -0
- package/package.json +13 -13
|
@@ -48,7 +48,8 @@ const handler = async ({
|
|
|
48
48
|
apiDebugPort,
|
|
49
49
|
debugBrk,
|
|
50
50
|
ud = false,
|
|
51
|
-
nodeArgs = ""
|
|
51
|
+
nodeArgs = "",
|
|
52
|
+
jobs: jobsOption
|
|
52
53
|
}) => {
|
|
53
54
|
recordTelemetryAttributes({
|
|
54
55
|
command: "dev",
|
|
@@ -280,6 +281,42 @@ const handler = async ({
|
|
|
280
281
|
prefixColor: "green"
|
|
281
282
|
});
|
|
282
283
|
}
|
|
284
|
+
const jobsConfigured = jobsOption !== false && workspace.includes("api") && !!cedarPaths.api.jobsConfig && // `getPaths()` resolves `jobsConfig` once and caches it in-process, so
|
|
285
|
+
// if `api/src/lib/jobs.ts` is deleted mid-session the cached path would
|
|
286
|
+
// otherwise still look "configured". Guard against starting a worker
|
|
287
|
+
// that can't load a jobs config that no longer exists.
|
|
288
|
+
fs.existsSync(cedarPaths.api.jobsConfig) && fs.existsSync(cedarPaths.api.jobs) && // Job files always live in `api/src/jobs/<ComponentName>Job/`
|
|
289
|
+
// subdirectories (see `generate/job/jobHandler.ts`), so entries here are
|
|
290
|
+
// directories, not files — only the `.keep` placeholder (and any stray
|
|
291
|
+
// dotfiles, e.g. `.DS_Store`) should be excluded.
|
|
292
|
+
fs.readdirSync(cedarPaths.api.jobs).some((entry) => !entry.startsWith("."));
|
|
293
|
+
if (jobsConfigured && unifiedDevCommand) {
|
|
294
|
+
console.log(
|
|
295
|
+
c.warning(
|
|
296
|
+
"Background jobs are not yet supported with Unified Dev (--ud). Run `cedar jobs work` in a separate terminal once you have a production-like `api/dist` build, or omit --ud for now."
|
|
297
|
+
)
|
|
298
|
+
);
|
|
299
|
+
} else if (jobsConfigured) {
|
|
300
|
+
jobs.push({
|
|
301
|
+
name: "jobs",
|
|
302
|
+
// `cedar-jobs work` loads its config and job files from `api/dist`
|
|
303
|
+
// (compiled output), not `api/src`. That dist output is only written
|
|
304
|
+
// once the `api` watcher's initial build finishes, which happens
|
|
305
|
+
// asynchronously — so on a clean `cedar dev` start there's a window
|
|
306
|
+
// where `api/dist` doesn't exist yet and the worker would exit
|
|
307
|
+
// immediately. Wrapping it in nodemon (same tool the `api` job above
|
|
308
|
+
// uses) means it retries as soon as `api/dist` changes, instead of
|
|
309
|
+
// staying dead for the rest of the session. This also means the
|
|
310
|
+
// worker restarts automatically whenever job code is rebuilt, since
|
|
311
|
+
// Node's ESM cache would otherwise keep serving stale job code.
|
|
312
|
+
command: formatRunBinCommand("nodemon", [
|
|
313
|
+
"--quiet",
|
|
314
|
+
`--watch "${cedarPaths.api.dist}"`,
|
|
315
|
+
`--exec "${formatRunBinCommand("cedar-jobs", ["work"])}"`
|
|
316
|
+
]),
|
|
317
|
+
prefixColor: "magenta"
|
|
318
|
+
});
|
|
319
|
+
}
|
|
283
320
|
const packageWorkspaces = workspace.filter(
|
|
284
321
|
(w) => w !== "api" && w !== "web" && w !== "gen"
|
|
285
322
|
);
|
package/dist/commands/dev.js
CHANGED
|
@@ -31,6 +31,9 @@ const builder = (yargs) => {
|
|
|
31
31
|
}).option("nodeArgs", {
|
|
32
32
|
type: "string",
|
|
33
33
|
description: 'CLI args to pass to the node process running the web dev server, for example: `--node-args="--inspect --max-old-space-size=8192"`.'
|
|
34
|
+
}).option("jobs", {
|
|
35
|
+
type: "boolean",
|
|
36
|
+
description: "Start the background jobs worker alongside the other dev servers when jobs are configured (`cedar setup jobs` + at least one `cedar g job`). Pass `--no-jobs` to opt out and run `cedar jobs work` yourself instead."
|
|
34
37
|
}).middleware(() => {
|
|
35
38
|
const check = checkNodeVersion();
|
|
36
39
|
if (check.ok) {
|
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.2931",
|
|
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.2931",
|
|
40
|
+
"@cedarjs/babel-config": "6.0.0-canary.2931",
|
|
41
|
+
"@cedarjs/cli-helpers": "6.0.0-canary.2931",
|
|
42
|
+
"@cedarjs/internal": "6.0.0-canary.2931",
|
|
43
|
+
"@cedarjs/prerender": "6.0.0-canary.2931",
|
|
44
|
+
"@cedarjs/project-config": "6.0.0-canary.2931",
|
|
45
|
+
"@cedarjs/structure": "6.0.0-canary.2931",
|
|
46
|
+
"@cedarjs/telemetry": "6.0.0-canary.2931",
|
|
47
|
+
"@cedarjs/utils": "6.0.0-canary.2931",
|
|
48
|
+
"@cedarjs/vite": "6.0.0-canary.2931",
|
|
49
|
+
"@cedarjs/web-server": "6.0.0-canary.2931",
|
|
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.2931",
|
|
98
98
|
"@prisma/dmmf": "7.8.0",
|
|
99
99
|
"@types/archiver": "^7.0.0",
|
|
100
100
|
"memfs": "4.68.1",
|