@cedarjs/cli 5.0.0-canary.2566 → 5.0.0-canary.2569
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.
|
@@ -50,20 +50,20 @@ const verifyServerConfig = (config) => {
|
|
|
50
50
|
if (!config.repo) {
|
|
51
51
|
throwMissingConfig("repo");
|
|
52
52
|
}
|
|
53
|
-
if (!/^\d+$/.test(config.freeSpaceRequired)) {
|
|
53
|
+
if (!/^\d+$/.test(String(config.freeSpaceRequired))) {
|
|
54
54
|
throw new Error('"freeSpaceRequired" must be an integer >= 0');
|
|
55
55
|
}
|
|
56
56
|
return true;
|
|
57
57
|
};
|
|
58
|
-
const symlinkCurrentCommand = async (dir, ssh,
|
|
59
|
-
return await ssh.exec(
|
|
58
|
+
const symlinkCurrentCommand = async (dir, ssh, deployPath) => {
|
|
59
|
+
return await ssh.exec(deployPath, "ln", [
|
|
60
60
|
SYMLINK_FLAGS,
|
|
61
61
|
dir,
|
|
62
62
|
CURRENT_RELEASE_SYMLINK_NAME
|
|
63
63
|
]);
|
|
64
64
|
};
|
|
65
|
-
const restartProcessCommand = async (processName, ssh, serverConfig,
|
|
66
|
-
return await ssh.exec(
|
|
65
|
+
const restartProcessCommand = async (processName, ssh, serverConfig, deployPath) => {
|
|
66
|
+
return await ssh.exec(deployPath, serverConfig.monitorCommand, [
|
|
67
67
|
"restart",
|
|
68
68
|
processName
|
|
69
69
|
]);
|
|
@@ -106,7 +106,7 @@ const maintenanceTasks = (status, ssh, serverConfig) => {
|
|
|
106
106
|
}
|
|
107
107
|
} else if (status === "down") {
|
|
108
108
|
tasks.push({
|
|
109
|
-
title: `Starting ${serverConfig.processNames
|
|
109
|
+
title: `Starting ${serverConfig.processNames?.join(", ")} processes...`,
|
|
110
110
|
task: async () => {
|
|
111
111
|
await ssh.exec(serverConfig.path, serverConfig.monitorCommand, [
|
|
112
112
|
"start",
|
|
@@ -133,7 +133,7 @@ const maintenanceTasks = (status, ssh, serverConfig) => {
|
|
|
133
133
|
};
|
|
134
134
|
const rollbackTasks = (count, ssh, serverConfig) => {
|
|
135
135
|
let rollbackCount = 1;
|
|
136
|
-
if (parseInt(count) === count) {
|
|
136
|
+
if (parseInt(String(count)) === count) {
|
|
137
137
|
rollbackCount = count;
|
|
138
138
|
}
|
|
139
139
|
const tasks = [
|
|
@@ -142,7 +142,7 @@ const rollbackTasks = (count, ssh, serverConfig) => {
|
|
|
142
142
|
task: async () => {
|
|
143
143
|
const currentLink = (await ssh.exec(serverConfig.path, "readlink", ["-f", "current"])).stdout.split("/").pop();
|
|
144
144
|
const dirs = (await ssh.exec(serverConfig.path, "ls", ["-t"])).stdout.split("\n").filter((dirs2) => !dirs2.match(/current/));
|
|
145
|
-
const deployedIndex = dirs.indexOf(currentLink);
|
|
145
|
+
const deployedIndex = dirs.indexOf(currentLink ?? "");
|
|
146
146
|
const rollbackIndex = deployedIndex + rollbackCount;
|
|
147
147
|
if (dirs[rollbackIndex]) {
|
|
148
148
|
console.info("Setting symlink");
|
|
@@ -153,7 +153,7 @@ const rollbackTasks = (count, ssh, serverConfig) => {
|
|
|
153
153
|
);
|
|
154
154
|
} else {
|
|
155
155
|
throw new Error(
|
|
156
|
-
`Cannot rollback ${rollbackCount} release(s): ${dirs.length - dirs.indexOf(currentLink) - 1} previous release(s) available`
|
|
156
|
+
`Cannot rollback ${rollbackCount} release(s): ${dirs.length - dirs.indexOf(currentLink ?? "") - 1} previous release(s) available`
|
|
157
157
|
);
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -191,19 +191,30 @@ const lifecycleTask = (lifecycle, task, skip, { serverLifecycle, ssh, cmdPath })
|
|
|
191
191
|
return tasks;
|
|
192
192
|
}
|
|
193
193
|
};
|
|
194
|
-
const commandWithLifecycleEvents = ({
|
|
194
|
+
const commandWithLifecycleEvents = ({
|
|
195
|
+
name,
|
|
196
|
+
config,
|
|
197
|
+
skip,
|
|
198
|
+
command
|
|
199
|
+
}) => {
|
|
195
200
|
const tasks = [];
|
|
196
201
|
tasks.push(lifecycleTask("before", name, skip, config));
|
|
197
202
|
tasks.push({ ...command, skip: () => skip });
|
|
198
203
|
tasks.push(lifecycleTask("after", name, skip, config));
|
|
199
|
-
return tasks.flat().filter((t) => t);
|
|
204
|
+
return tasks.flat().filter((t) => Boolean(t));
|
|
200
205
|
};
|
|
201
206
|
const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
202
207
|
const cmdPath = pathJoin(serverConfig.path, yargs.releaseDir);
|
|
203
|
-
const config = {
|
|
208
|
+
const config = {
|
|
209
|
+
yargs,
|
|
210
|
+
ssh,
|
|
211
|
+
serverConfig,
|
|
212
|
+
serverLifecycle,
|
|
213
|
+
cmdPath
|
|
214
|
+
};
|
|
204
215
|
const tasks = [];
|
|
205
216
|
tasks.push(
|
|
206
|
-
commandWithLifecycleEvents({
|
|
217
|
+
...commandWithLifecycleEvents({
|
|
207
218
|
name: "df",
|
|
208
219
|
config: { ...config, cmdPath: serverConfig.path },
|
|
209
220
|
skip: !yargs.df || serverConfig.freeSpaceRequired === 0 || serverConfig.freeSpaceRequired === "0",
|
|
@@ -230,7 +241,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
230
241
|
}
|
|
231
242
|
task.output = `Available disk space: ${dfMb}MB`;
|
|
232
243
|
const freeSpaceRequired = parseInt(
|
|
233
|
-
serverConfig.freeSpaceRequired ?? 2048,
|
|
244
|
+
String(serverConfig.freeSpaceRequired ?? 2048),
|
|
234
245
|
10
|
|
235
246
|
);
|
|
236
247
|
if (dfMb < freeSpaceRequired) {
|
|
@@ -243,7 +254,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
243
254
|
})
|
|
244
255
|
);
|
|
245
256
|
tasks.push(
|
|
246
|
-
commandWithLifecycleEvents({
|
|
257
|
+
...commandWithLifecycleEvents({
|
|
247
258
|
name: "update",
|
|
248
259
|
config: { ...config, cmdPath: serverConfig.path },
|
|
249
260
|
skip: !yargs.update,
|
|
@@ -262,7 +273,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
262
273
|
})
|
|
263
274
|
);
|
|
264
275
|
tasks.push(
|
|
265
|
-
commandWithLifecycleEvents({
|
|
276
|
+
...commandWithLifecycleEvents({
|
|
266
277
|
name: "symlinkEnv",
|
|
267
278
|
config,
|
|
268
279
|
skip: !yargs.update,
|
|
@@ -275,7 +286,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
275
286
|
})
|
|
276
287
|
);
|
|
277
288
|
tasks.push(
|
|
278
|
-
commandWithLifecycleEvents({
|
|
289
|
+
...commandWithLifecycleEvents({
|
|
279
290
|
name: "install",
|
|
280
291
|
config,
|
|
281
292
|
skip: !yargs.install,
|
|
@@ -290,7 +301,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
290
301
|
})
|
|
291
302
|
);
|
|
292
303
|
tasks.push(
|
|
293
|
-
commandWithLifecycleEvents({
|
|
304
|
+
...commandWithLifecycleEvents({
|
|
294
305
|
name: "migrate",
|
|
295
306
|
config,
|
|
296
307
|
skip: !yargs.migrate || serverConfig?.migrate === false,
|
|
@@ -322,7 +333,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
322
333
|
);
|
|
323
334
|
for (const side of serverConfig.sides) {
|
|
324
335
|
tasks.push(
|
|
325
|
-
commandWithLifecycleEvents({
|
|
336
|
+
...commandWithLifecycleEvents({
|
|
326
337
|
name: "build",
|
|
327
338
|
config,
|
|
328
339
|
skip: !yargs.build,
|
|
@@ -341,7 +352,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
341
352
|
);
|
|
342
353
|
}
|
|
343
354
|
tasks.push(
|
|
344
|
-
commandWithLifecycleEvents({
|
|
355
|
+
...commandWithLifecycleEvents({
|
|
345
356
|
name: "symlinkCurrent",
|
|
346
357
|
config,
|
|
347
358
|
skip: !yargs.update,
|
|
@@ -358,7 +369,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
358
369
|
for (const processName of serverConfig.processNames) {
|
|
359
370
|
if (yargs.firstRun) {
|
|
360
371
|
tasks.push(
|
|
361
|
-
commandWithLifecycleEvents({
|
|
372
|
+
...commandWithLifecycleEvents({
|
|
362
373
|
name: "restart",
|
|
363
374
|
config,
|
|
364
375
|
skip: !yargs.restart,
|
|
@@ -386,7 +397,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
386
397
|
});
|
|
387
398
|
} else {
|
|
388
399
|
tasks.push(
|
|
389
|
-
commandWithLifecycleEvents({
|
|
400
|
+
...commandWithLifecycleEvents({
|
|
390
401
|
name: "restart",
|
|
391
402
|
config,
|
|
392
403
|
skip: !yargs.restart,
|
|
@@ -407,7 +418,7 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
407
418
|
}
|
|
408
419
|
}
|
|
409
420
|
tasks.push(
|
|
410
|
-
commandWithLifecycleEvents({
|
|
421
|
+
...commandWithLifecycleEvents({
|
|
411
422
|
name: "cleanup",
|
|
412
423
|
config: { ...config, cmdPath: serverConfig.path },
|
|
413
424
|
skip: !yargs.cleanup,
|
|
@@ -423,14 +434,15 @@ const deployTasks = (yargs, ssh, serverConfig, serverLifecycle) => {
|
|
|
423
434
|
}
|
|
424
435
|
})
|
|
425
436
|
);
|
|
426
|
-
return tasks
|
|
437
|
+
return tasks;
|
|
427
438
|
};
|
|
428
439
|
const mergeLifecycleEvents = (lifecycle, other) => {
|
|
429
|
-
|
|
440
|
+
const lifecycleCopy = JSON.parse(JSON.stringify(lifecycle));
|
|
430
441
|
for (const hook of LIFECYCLE_HOOKS) {
|
|
431
|
-
|
|
442
|
+
const otherHook = other[hook] ?? {};
|
|
443
|
+
for (const key in otherHook) {
|
|
432
444
|
lifecycleCopy[hook][key] = (lifecycleCopy[hook][key] || []).concat(
|
|
433
|
-
|
|
445
|
+
otherHook[key]
|
|
434
446
|
);
|
|
435
447
|
}
|
|
436
448
|
}
|
|
@@ -439,26 +451,26 @@ const mergeLifecycleEvents = (lifecycle, other) => {
|
|
|
439
451
|
const parseConfig = (yargs, rawConfigToml) => {
|
|
440
452
|
const configToml = envInterpolation(rawConfigToml);
|
|
441
453
|
const config = toml.parse(configToml);
|
|
442
|
-
|
|
443
|
-
const emptyLifecycle = {};
|
|
454
|
+
const emptyLifecycle = { before: {}, after: {} };
|
|
444
455
|
verifyConfig(config, yargs);
|
|
445
|
-
for (const hook of LIFECYCLE_HOOKS) {
|
|
446
|
-
emptyLifecycle[hook] = {};
|
|
447
|
-
}
|
|
448
456
|
let envLifecycle = mergeLifecycleEvents(emptyLifecycle, config);
|
|
449
|
-
envConfig = config[yargs.environment];
|
|
457
|
+
const envConfig = config[yargs.environment];
|
|
450
458
|
envLifecycle = mergeLifecycleEvents(envLifecycle, envConfig);
|
|
451
459
|
return { envConfig, envLifecycle };
|
|
452
460
|
};
|
|
453
461
|
const commands = (yargs, ssh) => {
|
|
454
462
|
const deployConfig = fs.readFileSync(pathJoin(getPaths().base, CONFIG_FILENAME)).toString();
|
|
455
|
-
|
|
456
|
-
|
|
463
|
+
const { envConfig, envLifecycle } = parseConfig(yargs, deployConfig);
|
|
464
|
+
const servers = [];
|
|
457
465
|
let tasks = [];
|
|
458
|
-
|
|
466
|
+
const serverList = envConfig.servers ?? [];
|
|
467
|
+
for (const config of serverList) {
|
|
459
468
|
const serverConfig = serverConfigWithDefaults(config, yargs);
|
|
460
469
|
verifyServerConfig(serverConfig);
|
|
461
|
-
const serverLifecycle = mergeLifecycleEvents(
|
|
470
|
+
const serverLifecycle = mergeLifecycleEvents(
|
|
471
|
+
envLifecycle,
|
|
472
|
+
serverConfig
|
|
473
|
+
);
|
|
462
474
|
tasks.push({
|
|
463
475
|
title: "Connecting...",
|
|
464
476
|
task: () => ssh.connect({
|
|
@@ -467,9 +479,10 @@ const commands = (yargs, ssh) => {
|
|
|
467
479
|
username: serverConfig.username,
|
|
468
480
|
password: serverConfig.password,
|
|
469
481
|
privateKey: serverConfig.privateKey,
|
|
482
|
+
// @ts-expect-error - node-ssh Config doesn't expose privateKeyPath but it is supported at runtime
|
|
470
483
|
privateKeyPath: serverConfig.privateKeyPath,
|
|
471
484
|
passphrase: serverConfig.passphrase,
|
|
472
|
-
agent: serverConfig.agentForward
|
|
485
|
+
agent: serverConfig.agentForward ? process.env.SSH_AUTH_SOCK : void 0,
|
|
473
486
|
agentForward: serverConfig.agentForward
|
|
474
487
|
})
|
|
475
488
|
});
|
|
@@ -488,12 +501,14 @@ const commands = (yargs, ssh) => {
|
|
|
488
501
|
title: "Disconnecting...",
|
|
489
502
|
task: () => ssh.dispose()
|
|
490
503
|
});
|
|
504
|
+
const tasksCopy = [...tasks];
|
|
491
505
|
servers.push({
|
|
492
506
|
title: serverConfig.host,
|
|
493
507
|
task: () => {
|
|
494
|
-
return new Listr(
|
|
508
|
+
return new Listr(tasksCopy);
|
|
495
509
|
}
|
|
496
510
|
});
|
|
511
|
+
tasks = [];
|
|
497
512
|
}
|
|
498
513
|
return servers;
|
|
499
514
|
};
|
|
@@ -548,24 +563,26 @@ const handler = async (yargs) => {
|
|
|
548
563
|
if (yargs.gitCheck) {
|
|
549
564
|
await warnIfUnpushedCommits();
|
|
550
565
|
}
|
|
551
|
-
const ssh = new SshExecutor(yargs.verbose);
|
|
566
|
+
const ssh = new SshExecutor(yargs.verbose ?? false);
|
|
552
567
|
try {
|
|
553
|
-
const
|
|
568
|
+
const listrTasks = new Listr(commands(yargs, ssh), {
|
|
554
569
|
concurrent: true,
|
|
555
570
|
exitOnError: true,
|
|
556
|
-
renderer: yargs.verbose
|
|
571
|
+
renderer: yargs.verbose ? "verbose" : void 0
|
|
557
572
|
});
|
|
558
|
-
await
|
|
573
|
+
await listrTasks.run();
|
|
559
574
|
} catch (e) {
|
|
560
575
|
console.error(c.error("\nDeploy failed:"));
|
|
576
|
+
const errMessage = e instanceof Error && "stderr" in e ? e.stderr ?? e.message : e instanceof Error ? e.message : String(e);
|
|
577
|
+
const exitCode = e instanceof Error && "exitCode" in e ? e.exitCode ?? 1 : 1;
|
|
561
578
|
console.error(
|
|
562
|
-
boxen(
|
|
579
|
+
boxen(errMessage, {
|
|
563
580
|
padding: { top: 0, bottom: 0, right: 1, left: 1 },
|
|
564
581
|
margin: 0,
|
|
565
582
|
borderColor: "red"
|
|
566
583
|
})
|
|
567
584
|
);
|
|
568
|
-
process.exit(
|
|
585
|
+
process.exit(exitCode);
|
|
569
586
|
}
|
|
570
587
|
};
|
|
571
588
|
export {
|
|
@@ -100,10 +100,7 @@ async function handler(yargs) {
|
|
|
100
100
|
verbose: yargs.verbose,
|
|
101
101
|
gitCheck: yargs.gitCheck
|
|
102
102
|
});
|
|
103
|
-
const { handler: baremetalHandler } = (
|
|
104
|
-
// @ts-expect-error - baremetalHandler.js has no type declarations yet
|
|
105
|
-
await import("./baremetal/baremetalHandler.js")
|
|
106
|
-
);
|
|
103
|
+
const { handler: baremetalHandler } = await import("./baremetal/baremetalHandler.js");
|
|
107
104
|
return baremetalHandler(yargs);
|
|
108
105
|
}
|
|
109
106
|
export {
|
|
@@ -50,7 +50,7 @@ const getIdName = (model) => {
|
|
|
50
50
|
};
|
|
51
51
|
const isAutoGeneratedColumnForScaffold = (column) => {
|
|
52
52
|
const autoGeneratedFunctions = ["now", "autoincrement"];
|
|
53
|
-
const columnDefaultFunction = typeof column.default === "object" && "name" in column.default ? column.default
|
|
53
|
+
const columnDefaultFunction = typeof column.default === "object" && column.default !== null && "name" in column.default ? column.default.name : "";
|
|
54
54
|
return column.isId || column.isUpdatedAt || column.name === "createdAt" || autoGeneratedFunctions.includes(columnDefaultFunction);
|
|
55
55
|
};
|
|
56
56
|
const getImportComponentNames = (name, scaffoldPath, nestScaffoldByModel = true) => {
|
|
@@ -149,7 +149,7 @@ const files = async ({
|
|
|
149
149
|
};
|
|
150
150
|
};
|
|
151
151
|
const assetFiles = async (name, tailwind) => {
|
|
152
|
-
|
|
152
|
+
const fileList = {};
|
|
153
153
|
const assets = fs.readdirSync(
|
|
154
154
|
customOrDefaultTemplatePath({
|
|
155
155
|
side: "web",
|
|
@@ -274,12 +274,14 @@ const modelRelatedVariables = (model) => {
|
|
|
274
274
|
const relations = relationsForModel(model).map((relation) => relation);
|
|
275
275
|
const columns = model.fields.filter((field) => field.kind !== "object").map((column) => {
|
|
276
276
|
let validation;
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
);
|
|
277
|
+
const meta = componentMetadata[column.type];
|
|
278
|
+
const validationDef = meta?.validation;
|
|
279
|
+
if (typeof validationDef === "function") {
|
|
280
|
+
validation = validationDef(column.isRequired);
|
|
281
|
+
} else if (validationDef !== void 0) {
|
|
282
|
+
validation = column.isRequired ? validationDef : null;
|
|
281
283
|
} else {
|
|
282
|
-
validation = column
|
|
284
|
+
validation = column.isRequired ? componentMetadata.default.validation : null;
|
|
283
285
|
}
|
|
284
286
|
const isRelationalField = column.name.endsWith("Id") && relations.some((relation) => column.name.includes(relation));
|
|
285
287
|
const isRequired = column.isRequired;
|
|
@@ -308,7 +310,9 @@ const modelRelatedVariables = (model) => {
|
|
|
308
310
|
);
|
|
309
311
|
const fieldsToImport = Object.keys(
|
|
310
312
|
editableColumns.reduce((accumulator, column) => {
|
|
311
|
-
|
|
313
|
+
if (column.component) {
|
|
314
|
+
accumulator[column.component] = true;
|
|
315
|
+
}
|
|
312
316
|
return accumulator;
|
|
313
317
|
}, {})
|
|
314
318
|
);
|
|
@@ -326,7 +330,7 @@ const modelRelatedVariables = (model) => {
|
|
|
326
330
|
};
|
|
327
331
|
};
|
|
328
332
|
const layoutFiles = async (name, force, generateTypescript, templateStrings) => {
|
|
329
|
-
|
|
333
|
+
const fileList = {};
|
|
330
334
|
const layouts = fs.readdirSync(
|
|
331
335
|
customOrDefaultTemplatePath({
|
|
332
336
|
side: "web",
|
|
@@ -369,7 +373,7 @@ const pageFiles = async (name, pascalScaffoldPath = "", generateTypescript, nest
|
|
|
369
373
|
const idType = getIdType(model);
|
|
370
374
|
const idTsType = mapPrismaScalarToPagePropTsType(idType);
|
|
371
375
|
const idName = getIdName(model);
|
|
372
|
-
|
|
376
|
+
const fileList = {};
|
|
373
377
|
const pages = fs.readdirSync(
|
|
374
378
|
customOrDefaultTemplatePath({
|
|
375
379
|
side: "web",
|
|
@@ -411,9 +415,9 @@ const componentFiles = async (name, pascalScaffoldPath = "", generateTypescript,
|
|
|
411
415
|
const model = await getSchema(singularName);
|
|
412
416
|
const idType = getIdType(model);
|
|
413
417
|
const idName = getIdName(model);
|
|
414
|
-
const pascalIdName = pascalcase(idName);
|
|
418
|
+
const pascalIdName = pascalcase(idName ?? "");
|
|
415
419
|
const intForeignKeys = intForeignKeysForModel(model);
|
|
416
|
-
|
|
420
|
+
const fileList = {};
|
|
417
421
|
const components = fs.readdirSync(
|
|
418
422
|
customOrDefaultTemplatePath({
|
|
419
423
|
side: "web",
|
|
@@ -531,15 +535,15 @@ const addSetImport = (task) => {
|
|
|
531
535
|
writeFile(routesPath, newRoutesContent, { overwriteExisting: true });
|
|
532
536
|
return "Added Set import to Routes.{jsx,tsx}";
|
|
533
537
|
};
|
|
534
|
-
const addScaffoldSetToRouter = async (model,
|
|
535
|
-
const templateNames = getTemplateStrings(model,
|
|
538
|
+
const addScaffoldSetToRouter = async (model, scaffoldPath) => {
|
|
539
|
+
const templateNames = getTemplateStrings(model, scaffoldPath);
|
|
536
540
|
const nameVars = nameVariants(model);
|
|
537
541
|
const title = nameVars.pluralPascalName;
|
|
538
542
|
const titleTo = templateNames.pluralRouteName;
|
|
539
543
|
const buttonLabel = `New ${nameVars.singularPascalName}`;
|
|
540
544
|
const buttonTo = templateNames.newRouteName;
|
|
541
545
|
return addRoutesToRouterTask(
|
|
542
|
-
await routes({ model, path:
|
|
546
|
+
await routes({ model, path: scaffoldPath }),
|
|
543
547
|
"ScaffoldLayout",
|
|
544
548
|
{ title, titleTo, buttonLabel, buttonTo }
|
|
545
549
|
);
|
|
@@ -551,7 +555,7 @@ const tasks = ({
|
|
|
551
555
|
force,
|
|
552
556
|
tests,
|
|
553
557
|
typescript,
|
|
554
|
-
javascript,
|
|
558
|
+
javascript: _javascript,
|
|
555
559
|
tailwind
|
|
556
560
|
}) => {
|
|
557
561
|
return new Listr(
|
|
@@ -565,7 +569,6 @@ const tasks = ({
|
|
|
565
569
|
path: path2,
|
|
566
570
|
tests,
|
|
567
571
|
typescript,
|
|
568
|
-
javascript,
|
|
569
572
|
tailwind,
|
|
570
573
|
force
|
|
571
574
|
});
|
|
@@ -648,8 +651,10 @@ const handler = async ({
|
|
|
648
651
|
}
|
|
649
652
|
await t.run();
|
|
650
653
|
} catch (e) {
|
|
651
|
-
|
|
652
|
-
|
|
654
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
655
|
+
const exitCode = e instanceof Error && "exitCode" in e ? e.exitCode ?? 1 : 1;
|
|
656
|
+
console.log(c.error(message));
|
|
657
|
+
process.exit(exitCode);
|
|
653
658
|
}
|
|
654
659
|
};
|
|
655
660
|
const splitPathAndModel = (pathSlashModel) => {
|
package/dist/index.js
CHANGED
|
@@ -38,7 +38,12 @@ import { exitWithError } from "./lib/exit.js";
|
|
|
38
38
|
import * as updateCheck from "./lib/updateCheck.js";
|
|
39
39
|
import { loadPlugins } from "./plugin.js";
|
|
40
40
|
import { startTelemetry, shutdownTelemetry } from "./telemetry/index.js";
|
|
41
|
-
|
|
41
|
+
const {
|
|
42
|
+
telemetry,
|
|
43
|
+
help,
|
|
44
|
+
version,
|
|
45
|
+
cwd: parsedCwd
|
|
46
|
+
} = Parser(hideBin(process.argv), {
|
|
42
47
|
// Telemetry is enabled by default, but can be disabled in two ways
|
|
43
48
|
// - by passing a `--telemetry false` option
|
|
44
49
|
// - by setting a `CEDAR_DISABLE_TELEMETRY` env var
|
|
@@ -47,6 +52,7 @@ let { cwd, telemetry, help, version } = Parser(hideBin(process.argv), {
|
|
|
47
52
|
telemetry: (process.env.CEDAR_DISABLE_TELEMETRY === void 0 || process.env.CEDAR_DISABLE_TELEMETRY === "") && (process.env.REDWOOD_DISABLE_TELEMETRY === void 0 || process.env.REDWOOD_DISABLE_TELEMETRY === "")
|
|
48
53
|
}
|
|
49
54
|
});
|
|
55
|
+
let cwd = parsedCwd;
|
|
50
56
|
cwd ??= process.env.CEDAR_CWD;
|
|
51
57
|
cwd ??= process.env.RWJS_CWD;
|
|
52
58
|
cwd = getTomlDir(cwd);
|
|
@@ -168,7 +174,7 @@ function getTomlDir(cwd2) {
|
|
|
168
174
|
tomlDir = path.dirname(configTomlPath);
|
|
169
175
|
}
|
|
170
176
|
} catch (error) {
|
|
171
|
-
console.error(error.message);
|
|
177
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
172
178
|
process.exit(1);
|
|
173
179
|
}
|
|
174
180
|
return tomlDir;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cedarjs/cli",
|
|
3
|
-
"version": "5.0.0-canary.
|
|
3
|
+
"version": "5.0.0-canary.2569",
|
|
4
4
|
"description": "The CedarJS Command Line",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -33,17 +33,17 @@
|
|
|
33
33
|
"dependencies": {
|
|
34
34
|
"@babel/parser": "7.29.7",
|
|
35
35
|
"@babel/preset-typescript": "7.29.7",
|
|
36
|
-
"@cedarjs/api-server": "5.0.0-canary.
|
|
37
|
-
"@cedarjs/cli-helpers": "5.0.0-canary.
|
|
38
|
-
"@cedarjs/fastify-web": "5.0.0-canary.
|
|
39
|
-
"@cedarjs/internal": "5.0.0-canary.
|
|
40
|
-
"@cedarjs/prerender": "5.0.0-canary.
|
|
41
|
-
"@cedarjs/project-config": "5.0.0-canary.
|
|
42
|
-
"@cedarjs/structure": "5.0.0-canary.
|
|
43
|
-
"@cedarjs/telemetry": "5.0.0-canary.
|
|
44
|
-
"@cedarjs/utils": "5.0.0-canary.
|
|
45
|
-
"@cedarjs/vite": "5.0.0-canary.
|
|
46
|
-
"@cedarjs/web-server": "5.0.0-canary.
|
|
36
|
+
"@cedarjs/api-server": "5.0.0-canary.2569",
|
|
37
|
+
"@cedarjs/cli-helpers": "5.0.0-canary.2569",
|
|
38
|
+
"@cedarjs/fastify-web": "5.0.0-canary.2569",
|
|
39
|
+
"@cedarjs/internal": "5.0.0-canary.2569",
|
|
40
|
+
"@cedarjs/prerender": "5.0.0-canary.2569",
|
|
41
|
+
"@cedarjs/project-config": "5.0.0-canary.2569",
|
|
42
|
+
"@cedarjs/structure": "5.0.0-canary.2569",
|
|
43
|
+
"@cedarjs/telemetry": "5.0.0-canary.2569",
|
|
44
|
+
"@cedarjs/utils": "5.0.0-canary.2569",
|
|
45
|
+
"@cedarjs/vite": "5.0.0-canary.2569",
|
|
46
|
+
"@cedarjs/web-server": "5.0.0-canary.2569",
|
|
47
47
|
"@listr2/prompt-adapter-enquirer": "4.2.1",
|
|
48
48
|
"@opentelemetry/api": "1.9.1",
|
|
49
49
|
"@opentelemetry/core": "1.30.1",
|
|
File without changes
|