@cedarjs/cli 5.0.0-canary.2480 → 5.0.0-canary.2481

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.
@@ -13,19 +13,16 @@ import {
13
13
  EXPERIMENTAL_TOPIC_ID
14
14
  } from "./setupReactCompiler.js";
15
15
  import { printTaskEpilogue } from "./util.js";
16
- const handler = async ({
17
- force,
18
- verbose
19
- }) => {
16
+ const handler = async (options) => {
20
17
  const rwPaths = getPaths();
21
18
  const configTomlPath = getConfigPath();
22
19
  const configFileName = path.basename(configTomlPath);
23
20
  const configContent = fs.readFileSync(configTomlPath, "utf-8");
24
- const tasks = new Listr(
25
- [
21
+ function buildTaskData() {
22
+ return [
26
23
  {
27
24
  title: "Check prerequisites",
28
- skip: force,
25
+ skip: options.force,
29
26
  task: () => {
30
27
  if (!rwPaths.web.entryClient || !rwPaths.web.viteConfig) {
31
28
  throw new Error(
@@ -62,7 +59,7 @@ const handler = async ({
62
59
  }
63
60
  );
64
61
  } else {
65
- if (force) {
62
+ if (options.force) {
66
63
  task.output = `Overwriting config in ${configFileName}`;
67
64
  writeFile(
68
65
  configTomlPath,
@@ -82,11 +79,10 @@ const handler = async ({
82
79
  );
83
80
  }
84
81
  }
85
- },
86
- rendererOptions: { persistentOutput: true }
82
+ }
87
83
  },
88
- // We are using two different yarn commands here which is fine because they're operating on different
89
- // workspaces - web and the root
84
+ // We are using two different yarn commands here which is fine because
85
+ // they're operating on different workspaces - web and the root
90
86
  {
91
87
  title: "Installing eslint-plugin-react-compiler",
92
88
  task: async () => {
@@ -112,14 +108,26 @@ const handler = async ({
112
108
  printTaskEpilogue(command, description, EXPERIMENTAL_TOPIC_ID);
113
109
  }
114
110
  }
115
- ],
116
- {
117
- rendererOptions: { collapseSubtasks: false, persistentOutput: true },
118
- renderer: verbose ? "verbose" : "default"
119
- }
120
- );
111
+ ];
112
+ }
121
113
  try {
122
- await tasks.run();
114
+ if (options.verbose) {
115
+ await new Listr(buildTaskData(), {
116
+ exitOnError: true,
117
+ renderer: "verbose"
118
+ }).run();
119
+ } else {
120
+ await new Listr(
121
+ buildTaskData().map((t) => ({
122
+ ...t,
123
+ rendererOptions: { persistentOutput: true }
124
+ })),
125
+ {
126
+ exitOnError: true,
127
+ rendererOptions: { collapseSubtasks: false }
128
+ }
129
+ ).run();
130
+ }
123
131
  } catch (e) {
124
132
  const message = e instanceof Error ? e.message : String(e);
125
133
  const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
@@ -2,7 +2,7 @@ import { recordTelemetryAttributes } from "@cedarjs/cli-helpers";
2
2
  import { getEpilogue } from "./util.js";
3
3
  const command = "setup-streaming-ssr";
4
4
  const description = "Enable React Streaming and Server Side Rendering (SSR)";
5
- const EXPERIMENTAL_TOPIC_ID = 5052;
5
+ const EXPERIMENTAL_TOPIC_ID = "5052";
6
6
  const builder = (yargs) => {
7
7
  yargs.option("force", {
8
8
  alias: "f",
@@ -13,21 +13,18 @@ import {
13
13
  EXPERIMENTAL_TOPIC_ID
14
14
  } from "./setupStreamingSsr.js";
15
15
  import { printTaskEpilogue } from "./util.js";
16
- const handler = async ({
17
- force,
18
- verbose
19
- }) => {
20
- const rwPaths = getPaths();
16
+ const handler = async (options) => {
17
+ const cedarPaths = getPaths();
21
18
  const configPath = getConfigPath();
22
19
  const configContent = fs.readFileSync(configPath, "utf-8");
23
20
  const ts = isTypeScriptProject();
24
- const ext = path.extname(rwPaths.web.entryClient || "");
25
- const tasks = new Listr(
26
- [
21
+ const ext = path.extname(cedarPaths.web.entryClient || "");
22
+ function buildTaskData() {
23
+ return [
27
24
  {
28
25
  title: "Check prerequisites",
29
26
  task: () => {
30
- if (!rwPaths.web.entryClient || !rwPaths.web.viteConfig) {
27
+ if (!cedarPaths.web.entryClient || !cedarPaths.web.viteConfig) {
31
28
  throw new Error(
32
29
  "Vite needs to be setup before you can enable Streaming SSR"
33
30
  );
@@ -52,7 +49,7 @@ const handler = async ({
52
49
  }
53
50
  );
54
51
  } else {
55
- if (force) {
52
+ if (options.force) {
56
53
  task.output = "Overwriting config in cedar.toml";
57
54
  writeFile(
58
55
  configPath,
@@ -78,8 +75,7 @@ const handler = async ({
78
75
  );
79
76
  }
80
77
  }
81
- },
82
- rendererOptions: { persistentOutput: true }
78
+ }
83
79
  },
84
80
  {
85
81
  title: `Adding entry.client${ext}...`,
@@ -93,10 +89,13 @@ const handler = async ({
93
89
  ),
94
90
  "utf-8"
95
91
  );
96
- let entryClientPath = rwPaths.web.entryClient;
92
+ let entryClientPath = cedarPaths.web.entryClient;
93
+ if (!entryClientPath) {
94
+ throw new Error("entryClient is not set");
95
+ }
97
96
  const entryClientContent = ts ? entryClientTemplate : await transformTSToJS(entryClientPath, entryClientTemplate);
98
- let overwriteExisting = force;
99
- if (!force) {
97
+ let overwriteExisting = options.force;
98
+ if (!options.force) {
100
99
  const prompt = task.prompt(ListrEnquirerPromptAdapter);
101
100
  overwriteExisting = await prompt.run({
102
101
  type: "Confirm",
@@ -109,8 +108,7 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
109
108
  }
110
109
  }
111
110
  writeFile(entryClientPath, entryClientContent, { overwriteExisting });
112
- },
113
- rendererOptions: { persistentOutput: true }
111
+ }
114
112
  },
115
113
  {
116
114
  title: `Adding entry.server${ext}...`,
@@ -125,12 +123,12 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
125
123
  "utf-8"
126
124
  );
127
125
  const entryServerPath = path.join(
128
- rwPaths.web.src,
126
+ cedarPaths.web.src,
129
127
  `entry.server${ext}`
130
128
  );
131
129
  const entryServerContent = ts ? entryServerTemplate : await transformTSToJS(entryServerPath, entryServerTemplate);
132
130
  writeFile(entryServerPath, entryServerContent, {
133
- overwriteExisting: force
131
+ overwriteExisting: options.force
134
132
  });
135
133
  }
136
134
  },
@@ -146,10 +144,10 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
146
144
  ),
147
145
  "utf-8"
148
146
  );
149
- const documentPath = path.join(rwPaths.web.src, `Document${ext}`);
147
+ const documentPath = path.join(cedarPaths.web.src, `Document${ext}`);
150
148
  const documentContent = ts ? documentTemplate : await transformTSToJS(documentPath, documentTemplate);
151
149
  writeFile(documentPath, documentContent, {
152
- overwriteExisting: force
150
+ overwriteExisting: options.force
153
151
  });
154
152
  }
155
153
  },
@@ -166,18 +164,18 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
166
164
  "utf-8"
167
165
  );
168
166
  const tsconfigPath = path.join(
169
- rwPaths.web.base,
167
+ cedarPaths.web.base,
170
168
  ts ? "tsconfig.json" : "jsconfig.json"
171
169
  );
172
170
  writeFile(tsconfigPath, tsconfigTemplate, {
173
- overwriteExisting: force
171
+ overwriteExisting: options.force
174
172
  });
175
173
  }
176
174
  },
177
175
  {
178
176
  title: 'Adding resolution for "@apollo/client-react-streaming/superjson"',
179
177
  task: () => {
180
- const pkgJsonPath = path.join(rwPaths.base, "package.json");
178
+ const pkgJsonPath = path.join(cedarPaths.base, "package.json");
181
179
  const pkgJson = JSON.parse(fs.readFileSync(pkgJsonPath, "utf-8"));
182
180
  const resolutions = pkgJson.resolutions || {};
183
181
  resolutions["@apollo/client-react-streaming/superjson"] = "^1.12.2";
@@ -191,14 +189,26 @@ You'll manually need to merge it with your existing entry.client${ext} file.`;
191
189
  printTaskEpilogue(command, description, EXPERIMENTAL_TOPIC_ID);
192
190
  }
193
191
  }
194
- ],
195
- {
196
- rendererOptions: { collapseSubtasks: false, persistentOutput: true },
197
- renderer: verbose ? "verbose" : "default"
198
- }
199
- );
192
+ ];
193
+ }
200
194
  try {
201
- await tasks.run();
195
+ if (options.verbose) {
196
+ await new Listr(buildTaskData(), {
197
+ exitOnError: true,
198
+ renderer: "verbose"
199
+ }).run();
200
+ } else {
201
+ await new Listr(
202
+ buildTaskData().map((t) => ({
203
+ ...t,
204
+ rendererOptions: { persistentOutput: true }
205
+ })),
206
+ {
207
+ exitOnError: true,
208
+ rendererOptions: { collapseSubtasks: false }
209
+ }
210
+ ).run();
211
+ }
202
212
  } catch (e) {
203
213
  const message = e instanceof Error ? e.message : String(e);
204
214
  const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
@@ -66,8 +66,8 @@ async function handler({
66
66
  });
67
67
  functionType = response.functionType;
68
68
  }
69
- const tasks = new Listr(
70
- [
69
+ function buildTaskData() {
70
+ return [
71
71
  {
72
72
  title: "Checking for realtime environment prerequisites ...",
73
73
  task: () => {
@@ -207,14 +207,31 @@ async function handler({
207
207
  );
208
208
  }
209
209
  }
210
- ],
211
- {
212
- rendererOptions: { collapseSubtasks: false, persistentOutput: true },
213
- renderer: silent ? "silent" : verbose ? "verbose" : "default"
214
- }
215
- );
210
+ ];
211
+ }
216
212
  try {
217
- await tasks.run();
213
+ if (silent) {
214
+ await new Listr(buildTaskData(), {
215
+ exitOnError: true,
216
+ renderer: "silent"
217
+ }).run();
218
+ } else if (verbose) {
219
+ await new Listr(buildTaskData(), {
220
+ exitOnError: true,
221
+ renderer: "verbose"
222
+ }).run();
223
+ } else {
224
+ await new Listr(
225
+ buildTaskData().map((t) => ({
226
+ ...t,
227
+ rendererOptions: { persistentOutput: true }
228
+ })),
229
+ {
230
+ exitOnError: true,
231
+ rendererOptions: { collapseSubtasks: false }
232
+ }
233
+ ).run();
234
+ }
218
235
  } catch (e) {
219
236
  const message = e instanceof Error ? e.message : String(e);
220
237
  const exitCode = e instanceof Error && "exitCode" in e && typeof e.exitCode === "number" ? e.exitCode : 1;
package/dist/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import https from "https";
2
1
  import fs from "node:fs";
3
- import path from "path";
2
+ import https from "node:https";
3
+ import path from "node:path";
4
4
  import * as babel from "@babel/core";
5
5
  import boxen from "boxen";
6
6
  import camelcase from "camelcase";
@@ -18,8 +18,8 @@ import {
18
18
  addWorkspacePackages
19
19
  } from "@cedarjs/cli-helpers/packageManager/packages";
20
20
  import {
21
- getConfig as getRedwoodConfig,
22
- getPaths as getRedwoodPaths,
21
+ getConfig as getCedarConfig,
22
+ getPaths as getCedarPaths,
23
23
  resolveFile as internalResolveFile,
24
24
  findUp
25
25
  } from "@cedarjs/project-config";
@@ -50,6 +50,7 @@ const generateTemplate = (templateFilename, { name, ...rest }) => {
50
50
  });
51
51
  return prettify(templateFilename, renderedTemplate);
52
52
  } catch (error) {
53
+ ;
53
54
  error.message = `Error applying template at ${templateFilename} for ${name}: ${error.message}`;
54
55
  throw error;
55
56
  }
@@ -131,17 +132,17 @@ async function getInstalledCedarVersion() {
131
132
  try {
132
133
  const packageJson = await import("../../package.json", { with: { type: "json" } });
133
134
  return packageJson.default.version;
134
- } catch (e) {
135
+ } catch {
135
136
  console.error(c.error("Could not find installed Cedar version"));
136
137
  process.exit(1);
137
138
  }
138
139
  }
139
- const bytes = (contents) => Buffer.byteLength(contents, "utf8");
140
140
  const _getPaths = () => {
141
141
  try {
142
- return getRedwoodPaths();
142
+ return getCedarPaths();
143
143
  } catch (e) {
144
- console.error(c.error(e.message));
144
+ const message = e instanceof Error ? e.message : String(e);
145
+ console.error(c.error(message));
145
146
  process.exit(1);
146
147
  }
147
148
  };
@@ -149,13 +150,15 @@ const getPaths = memoize(_getPaths);
149
150
  const resolveFile = internalResolveFile;
150
151
  const getGraphqlPath = () => resolveFile(path.join(getPaths().api.functions, "graphql"));
151
152
  const graphFunctionDoesExist = () => {
152
- return fs.existsSync(getGraphqlPath());
153
+ const graphqlPath = getGraphqlPath();
154
+ return graphqlPath ? fs.existsSync(graphqlPath) : false;
153
155
  };
154
156
  const getConfig = () => {
155
157
  try {
156
- return getRedwoodConfig();
158
+ return getCedarConfig();
157
159
  } catch (e) {
158
- console.error(c.error(e.message));
160
+ const message = e instanceof Error ? e.message : String(e);
161
+ console.error(c.error(message));
159
162
  process.exit(1);
160
163
  }
161
164
  };
@@ -166,7 +169,7 @@ const getPrettierOptions = async () => {
166
169
  const prettierConfigPath = fs.existsSync(cjsPath) ? cjsPath : mjsPath;
167
170
  const { default: prettierOptions } = await import(`file://${prettierConfigPath}`);
168
171
  return prettierOptions;
169
- } catch (e) {
172
+ } catch {
170
173
  if (process.env.VITEST_POOL_ID !== void 0) {
171
174
  return {
172
175
  trailingComma: "es5",
@@ -189,10 +192,10 @@ const getPrettierOptions = async () => {
189
192
  }
190
193
  };
191
194
  const transformTSToJS = async (filename, content) => {
192
- const { code } = babel.transform(content, {
195
+ const result = babel.transform(content, {
193
196
  filename,
194
- // If you ran `yarn cedar generate` in `./web` transformSync would import the `.babelrc.js` file,
195
- // in `./web`? despite us setting `configFile: false`.
197
+ // If you ran `yarn cedar generate` in `./web` transformSync would import
198
+ // the `.babelrc.js` file, in `./web` despite us setting `configFile: false`
196
199
  cwd: process.env.NODE_ENV === "test" ? void 0 : getPaths().base,
197
200
  configFile: false,
198
201
  plugins: [
@@ -206,6 +209,7 @@ const transformTSToJS = async (filename, content) => {
206
209
  ],
207
210
  retainLines: true
208
211
  });
212
+ const code = result?.code ?? "";
209
213
  return prettify(filename.replace(/\.ts(x)?$/, ".js$1"), code);
210
214
  };
211
215
  const writeFilesTask = (files, options) => {
@@ -215,7 +219,7 @@ const writeFilesTask = (files, options) => {
215
219
  const contents = files[file];
216
220
  return {
217
221
  title: `...waiting to write file \`./${path.relative(base, file)}\`...`,
218
- task: (ctx, task) => writeFile(file, contents, options, task)
222
+ task: (_ctx, task) => writeFile(file, contents, options, task)
219
223
  };
220
224
  })
221
225
  );
@@ -273,7 +277,7 @@ const cleanupEmptyDirsTask = (files) => {
273
277
  const wrapWithSet = (routesContent, layout, routes, newLineAndIndent, props = {}) => {
274
278
  const [_, indentOne, indentTwo] = routesContent.match(
275
279
  /([ \t]*)<Router.*?>[^<]*[\r\n]+([ \t]+)/
276
- ) || ["", 0, 2];
280
+ ) || ["", "", ""];
277
281
  const oneLevelIndent = indentTwo.slice(0, indentTwo.length - indentOne.length);
278
282
  const newRoutesWithExtraIndent = routes.map((route) => oneLevelIndent + route);
279
283
  const propsString = Object.entries(props).map((values) => `${values[0]}="${values[1]}"`).join(" ");
@@ -283,7 +287,7 @@ const wrapWithSet = (routesContent, layout, routes, newLineAndIndent, props = {}
283
287
  `</Set>`
284
288
  ].join(newLineAndIndent);
285
289
  };
286
- const addRoutesToRouterTask = (routes, layout, setProps = {}) => {
290
+ function addRoutesToRouterTask(routes, layout, setProps = {}) {
287
291
  const cedarPaths = getPaths();
288
292
  const routesContent = readFile(cedarPaths.web.routes).toString();
289
293
  let newRoutes = routes.filter((route) => !routesContent.match(route));
@@ -315,7 +319,7 @@ ${route}`);
315
319
  overwriteExisting: true
316
320
  });
317
321
  }
318
- };
322
+ }
319
323
  const addScaffoldImport = () => {
320
324
  const appJsPath = getPaths().web.app;
321
325
  let appJsContents = readFile(appJsPath).toString();
@@ -329,7 +333,7 @@ const addScaffoldImport = () => {
329
333
  writeFile(appJsPath, appJsContents, { overwriteExisting: true });
330
334
  return "Added scaffold import to App.{jsx,tsx}";
331
335
  };
332
- const removeEmtpySet = (routesContent, layout) => {
336
+ function removeEmtpySet(routesContent, layout) {
333
337
  const setWithLayoutReg = new RegExp(
334
338
  `\\s*<Set[^>]*wrap={${layout}}[^<]*>([^<]*)</Set>`
335
339
  );
@@ -342,8 +346,8 @@ const removeEmtpySet = (routesContent, layout) => {
342
346
  return routesContent;
343
347
  }
344
348
  return routesContent.replace(setWithLayoutReg, "");
345
- };
346
- const removeRoutesFromRouterTask = (routes, layout) => {
349
+ }
350
+ function removeRoutesFromRouterTask(routes, layout) {
347
351
  const cedarPaths = getPaths();
348
352
  const routesContent = readFile(cedarPaths.web.routes).toString();
349
353
  const newRoutesContent = routes.reduce((content, route) => {
@@ -354,7 +358,7 @@ const removeRoutesFromRouterTask = (routes, layout) => {
354
358
  writeFile(cedarPaths.web.routes, routesWithoutEmptySet, {
355
359
  overwriteExisting: true
356
360
  });
357
- };
361
+ }
358
362
  const addPackagesTask = async ({
359
363
  packages,
360
364
  side = "project",
@@ -399,7 +403,7 @@ const runCommandTask = async (commands, { verbose, silent }) => {
399
403
  })),
400
404
  {
401
405
  renderer: silent ? "silent" : verbose ? "verbose" : "default",
402
- rendererOptions: { collapseSubtasks: false, dateFormat: false }
406
+ rendererOptions: { collapseSubtasks: false }
403
407
  }
404
408
  );
405
409
  try {
@@ -433,7 +437,7 @@ const printSetupNotes = (notes) => {
433
437
  ${boxen(notes.join("\n"), {
434
438
  padding: { top: 1, bottom: 1, right: 1, left: 1 },
435
439
  margin: 1,
436
- borderColour: "gray"
440
+ borderColor: "gray"
437
441
  })}
438
442
  `;
439
443
  }
@@ -444,7 +448,6 @@ export {
444
448
  addPackagesTask,
445
449
  addRoutesToRouterTask,
446
450
  addScaffoldImport,
447
- bytes,
448
451
  cleanupEmptyDirsTask,
449
452
  deleteFile,
450
453
  deleteFilesTask,
@@ -51,16 +51,23 @@ const PLUGIN_CACHE_BUILTIN = [
51
51
  "tc",
52
52
  "upgrade"
53
53
  ];
54
+ function isErrorWithCode(error, code) {
55
+ return typeof error === "object" && error !== null && "code" in error && error.code === code;
56
+ }
54
57
  function loadCommandCache() {
55
- let pluginCommandCache = PLUGIN_CACHE_DEFAULT;
58
+ let pluginCommandCache = { ...PLUGIN_CACHE_DEFAULT };
56
59
  const commandCachePath = path.join(
57
60
  getPaths().generated.base,
58
61
  PLUGIN_CACHE_FILENAME
59
62
  );
60
63
  try {
61
- const localCommandCache = JSON.parse(fs.readFileSync(commandCachePath));
64
+ const localCommandCache = JSON.parse(
65
+ fs.readFileSync(commandCachePath, "utf8")
66
+ );
62
67
  let valid = true;
63
- for (const [key, value] of Object.entries(localCommandCache)) {
68
+ for (const [key, value] of Object.entries(
69
+ localCommandCache
70
+ )) {
64
71
  if (key === "_builtin") {
65
72
  continue;
66
73
  }
@@ -73,7 +80,7 @@ function loadCommandCache() {
73
80
  };
74
81
  }
75
82
  } catch (error) {
76
- if (error.code !== "ENOENT") {
83
+ if (!isErrorWithCode(error, "ENOENT")) {
77
84
  console.error(`Error loading plugin command cache at ${commandCachePath}`);
78
85
  console.error(error);
79
86
  }
@@ -162,7 +169,7 @@ async function installPluginPackage(packageName, packageVersion) {
162
169
  console.log(
163
170
  "The following error occurred while checking plugin compatibility for automatic installation:"
164
171
  );
165
- const errorMessage = error.message ?? error;
172
+ const errorMessage = error instanceof Error ? error.message : String(error);
166
173
  console.log(errorMessage);
167
174
  if (errorMessage.includes("does not have a tag") || errorMessage.includes("does not have a version")) {
168
175
  process.exit(1);
package/dist/plugin.js CHANGED
@@ -59,8 +59,6 @@ async function loadPlugins(yargs) {
59
59
  yargs.command({
60
60
  command: `${namespace} <command>`,
61
61
  describe: `Commands from ${namespace}`,
62
- builder: () => {
63
- },
64
62
  handler: () => {
65
63
  }
66
64
  });
@@ -97,6 +95,7 @@ async function loadPlugins(yargs) {
97
95
  describe: `Commands from ${namespaceInUse}`,
98
96
  builder: (yargs2) => {
99
97
  yargs2.command(commands).demandCommand();
98
+ return yargs2;
100
99
  },
101
100
  handler: () => {
102
101
  }
@@ -108,13 +107,11 @@ async function loadPlugins(yargs) {
108
107
  }
109
108
  const packagesToLoad = /* @__PURE__ */ new Set();
110
109
  for (const [packageName, cacheEntry] of Object.entries(pluginCommandCache)) {
111
- if (packageName === "_builtin") {
110
+ if (packageName === "_builtin" || Array.isArray(cacheEntry)) {
112
111
  continue;
113
112
  }
114
113
  const commandFirstWords = [];
115
- for (const [command, info] of Object.entries(
116
- cacheEntry
117
- )) {
114
+ for (const [command, info] of Object.entries(cacheEntry)) {
118
115
  commandFirstWords.push(command.split(" ")[0]);
119
116
  commandFirstWords.push(
120
117
  ...info.aliases?.map((a) => a.split(" ")[0]) ?? []
@@ -136,6 +133,9 @@ async function loadPlugins(yargs) {
136
133
  const commandsToRegister = [];
137
134
  if (foundMatchingPackage) {
138
135
  const packageToLoad = packagesToLoad.values().next().value;
136
+ if (!packageToLoad) {
137
+ throw new Error(`Invalid first value in ${packagesToLoad}`);
138
+ }
139
139
  const commands = await loadCommandsFromCacheOrPackage(
140
140
  packageToLoad,
141
141
  pluginCommandCache,
@@ -162,6 +162,7 @@ async function loadPlugins(yargs) {
162
162
  describe: `Commands from ${namespaceInUse}`,
163
163
  builder: (yargs2) => {
164
164
  yargs2.command(commandsToRegister).demandCommand();
165
+ return yargs2;
165
166
  },
166
167
  handler: () => {
167
168
  }
@@ -175,8 +176,6 @@ async function loadPlugins(yargs) {
175
176
  yargs.command({
176
177
  command: `${namespace} <command>`,
177
178
  describe: `Commands from ${namespace}`,
178
- builder: () => {
179
- },
180
179
  handler: () => {
181
180
  }
182
181
  });
@@ -187,8 +186,11 @@ async function loadPlugins(yargs) {
187
186
  }
188
187
  async function loadCommandsFromCacheOrPackage(packageName, cache, autoInstall, readFromCache) {
189
188
  let cacheEntry = void 0;
190
- if (readFromCache) {
191
- cacheEntry = cache !== void 0 ? cache[packageName] : void 0;
189
+ if (readFromCache && cache) {
190
+ const entry = cache[packageName];
191
+ if (entry && !Array.isArray(entry)) {
192
+ cacheEntry = entry;
193
+ }
192
194
  }
193
195
  if (cacheEntry !== void 0) {
194
196
  const commands = Object.entries(cacheEntry).map(([command, info]) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cedarjs/cli",
3
- "version": "5.0.0-canary.2480",
3
+ "version": "5.0.0-canary.2481",
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.3",
35
35
  "@babel/preset-typescript": "7.28.5",
36
- "@cedarjs/api-server": "5.0.0-canary.2480",
37
- "@cedarjs/cli-helpers": "5.0.0-canary.2480",
38
- "@cedarjs/fastify-web": "5.0.0-canary.2480",
39
- "@cedarjs/internal": "5.0.0-canary.2480",
40
- "@cedarjs/prerender": "5.0.0-canary.2480",
41
- "@cedarjs/project-config": "5.0.0-canary.2480",
42
- "@cedarjs/structure": "5.0.0-canary.2480",
43
- "@cedarjs/telemetry": "5.0.0-canary.2480",
44
- "@cedarjs/utils": "5.0.0-canary.2480",
45
- "@cedarjs/vite": "5.0.0-canary.2480",
46
- "@cedarjs/web-server": "5.0.0-canary.2480",
36
+ "@cedarjs/api-server": "5.0.0-canary.2481",
37
+ "@cedarjs/cli-helpers": "5.0.0-canary.2481",
38
+ "@cedarjs/fastify-web": "5.0.0-canary.2481",
39
+ "@cedarjs/internal": "5.0.0-canary.2481",
40
+ "@cedarjs/prerender": "5.0.0-canary.2481",
41
+ "@cedarjs/project-config": "5.0.0-canary.2481",
42
+ "@cedarjs/structure": "5.0.0-canary.2481",
43
+ "@cedarjs/telemetry": "5.0.0-canary.2481",
44
+ "@cedarjs/utils": "5.0.0-canary.2481",
45
+ "@cedarjs/vite": "5.0.0-canary.2481",
46
+ "@cedarjs/web-server": "5.0.0-canary.2481",
47
47
  "@listr2/prompt-adapter-enquirer": "4.2.1",
48
48
  "@opentelemetry/api": "1.9.1",
49
49
  "@opentelemetry/core": "1.30.1",