@kubb/cli 1.1.11 → 1.1.13

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/index.js CHANGED
@@ -1,12 +1,10 @@
1
- #!/usr/bin/env node
2
1
  import { createRequire } from 'module';
3
2
  import pathParser from 'node:path';
4
- import { Command, Option } from 'commander';
3
+ import { Command, CommanderError, Option } from 'commander';
5
4
  import ora from 'ora';
6
5
  import pc3 from 'picocolors';
7
- import { write, throttle, build, ParallelPluginError, PluginError, isPromise } from '@kubb/core';
6
+ import { write, throttle, build, PluginError, ParallelPluginError, SummaryError, isPromise, timeout } from '@kubb/core';
8
7
  import { $, execa } from 'execa';
9
- import PrettyError from 'pretty-error';
10
8
  import { parseArgsStringToArgv } from 'string-argv';
11
9
  import { Writable } from 'node:stream';
12
10
  import mod from 'node:module';
@@ -14,6 +12,7 @@ import { pathToFileURL } from 'node:url';
14
12
  import { cosmiconfig } from 'cosmiconfig';
15
13
  import tsNode from 'ts-node';
16
14
  import yaml from 'yaml';
15
+ import PrettyError from 'pretty-error';
17
16
 
18
17
  const require = createRequire(import.meta.url);
19
18
 
@@ -26,7 +25,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
26
25
  });
27
26
 
28
27
  // package.json
29
- var version = "1.1.11";
28
+ var version = "1.1.13";
30
29
  var presets = {
31
30
  simple: {
32
31
  "kubb.config": `
@@ -55,29 +54,23 @@ export default defineConfig({
55
54
  }
56
55
  };
57
56
  async function init({ spinner: spinner2, preset = "simple", logLevel = "silent", packageManager = "pnpm" }) {
58
- try {
59
- const presetMeta = presets[preset];
60
- const path = pathParser.resolve(process.cwd(), "./kubb.config.js");
61
- const installCommand = packageManager === "npm" ? "install" : "add";
62
- spinner2.start(`\u{1F4C0} Writing \`kubb.config.js\` ${pc3.dim(path)}`);
63
- await write(presetMeta["kubb.config"], path);
64
- spinner2.succeed(`\u{1F4C0} Wrote \`kubb.config.js\` ${pc3.dim(path)}`);
65
- const data = await Promise.all([
66
- $`npm init es6 -y`,
67
- ...presetMeta.packages.map(async (pack) => {
68
- spinner2.start(`\u{1F4C0} Installing ${pc3.dim(pack)}`);
69
- const { stdout } = await $({ preferLocal: false })`${packageManager} ${installCommand} ${pack}`;
70
- spinner2.succeed(`\u{1F4C0} Installed ${pc3.dim(pack)}`);
71
- return stdout;
72
- })
73
- ]);
74
- if (logLevel === "info") {
75
- data.forEach((text) => console.log(text));
76
- }
77
- } catch (error) {
78
- spinner2.fail(pc3.red(`Something went wrong
79
-
80
- ${error?.message}`));
57
+ const presetMeta = presets[preset];
58
+ const path = pathParser.resolve(process.cwd(), "./kubb.config.js");
59
+ const installCommand = packageManager === "npm" ? "install" : "add";
60
+ spinner2.start(`\u{1F4C0} Writing \`kubb.config.js\` ${pc3.dim(path)}`);
61
+ await write(presetMeta["kubb.config"], path);
62
+ spinner2.succeed(`\u{1F4C0} Wrote \`kubb.config.js\` ${pc3.dim(path)}`);
63
+ const data = await Promise.all([
64
+ $`npm init es6 -y`,
65
+ ...presetMeta.packages.map(async (pack) => {
66
+ spinner2.start(`\u{1F4C0} Installing ${pc3.dim(pack)}`);
67
+ const { stdout } = await $({ preferLocal: false })`${packageManager} ${installCommand} ${pack}`;
68
+ spinner2.succeed(`\u{1F4C0} Installed ${pc3.dim(pack)}`);
69
+ return stdout;
70
+ })
71
+ ]);
72
+ if (logLevel === "info") {
73
+ data.forEach((text) => console.log(text));
81
74
  }
82
75
  }
83
76
 
@@ -108,26 +101,22 @@ ${pc3.bold(pc3.blue(this.command))}: ${chunk?.toString()}`;
108
101
  };
109
102
 
110
103
  // src/run.ts
111
- async function run({ config, options, spinner: spinner2 }) {
104
+ async function run({ config, options }) {
112
105
  const hrstart = process.hrtime();
113
106
  const [log] = throttle((message, { logLevel, params }) => {
114
107
  if (logLevel === "error") {
115
- spinner2.fail(pc3.red(`${message}
116
-
117
- ` || `Something went wrong
118
-
119
- `));
108
+ throw new Error(message || "Something went wrong");
120
109
  } else if (logLevel === "info") {
121
110
  if (message) {
122
- spinner2.text = message;
111
+ spinner.text = message;
123
112
  } else {
124
- spinner2.text = `\u{1FA82} Executing ${params?.hookName || "unknown"}(${pc3.yellow(params?.pluginName || "unknown")})`;
113
+ spinner.text = `\u{1FA82} Executing ${params?.hookName || "unknown"}(${pc3.yellow(params?.pluginName || "unknown")})`;
125
114
  }
126
115
  }
127
116
  }, 100);
128
117
  const logger = {
129
118
  log,
130
- spinner: spinner2
119
+ spinner
131
120
  };
132
121
  const onDone = async (hooks, logLevel) => {
133
122
  if (!hooks?.done) {
@@ -140,23 +129,25 @@ async function run({ config, options, spinner: spinner2 }) {
140
129
  commands = hooks.done;
141
130
  }
142
131
  const promises = commands.map(async (command) => {
143
- const oraWritable = new OraWritable(spinner2, command);
132
+ const oraWritable = new OraWritable(spinner, command);
144
133
  const [cmd, ..._args] = [...parseArgsStringToArgv(command)];
145
- spinner2.start(parseText(`\u{1FA82} Executing hooks(${pc3.yellow("done")})`, { info: ` ${pc3.dim(command)}` }, logLevel));
134
+ spinner.start(parseText(`\u{1FA82} Executing hooks(${pc3.yellow("done")})`, { info: ` ${pc3.dim(command)}` }, logLevel));
146
135
  const { stdout } = await execa(cmd, _args, {}).pipeStdout(oraWritable);
147
- spinner2.suffixText = "";
136
+ spinner.suffixText = "";
148
137
  oraWritable.destroy();
138
+ await timeout(50);
149
139
  if (logLevel === "info") {
150
- spinner2.succeed(parseText(`\u{1FA82} Executing hooks(${pc3.yellow("done")})`, { info: ` ${pc3.dim(command)}` }, logLevel));
140
+ spinner.succeed(parseText(`\u{1FA82} Executing hooks(${pc3.yellow("done")})`, { info: ` ${pc3.dim(command)}` }, logLevel));
151
141
  console.log(stdout);
152
142
  }
153
143
  });
154
144
  await Promise.all(promises);
155
145
  if (logLevel === "silent") {
156
- spinner2.succeed(parseText(`\u{1FA82} Executing hooks(${pc3.yellow("done")})`, {}, logLevel));
146
+ spinner.succeed(parseText(`\u{1FA82} Executing hooks(${pc3.yellow("done")})`, {}, logLevel));
157
147
  }
158
148
  };
159
- const printSummary = (pluginManager, status) => {
149
+ const getSummary = (pluginManager, status) => {
150
+ const logs = [];
160
151
  const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrstart));
161
152
  const buildStartPlugins = [
162
153
  ...new Set(pluginManager.executed.filter((item) => item.hookName === "buildStart" && item.plugin.name !== "core").map((item) => item.plugin.name))
@@ -175,44 +166,30 @@ async function run({ config, options, spinner: spinner2 }) {
175
166
  return 0;
176
167
  });
177
168
  const meta = {
178
- plugins: status === "success" ? `${pc3.green(`${buildStartPlugins.length} successful`)}, ${pluginsCount} total` : `${pc3.red(`${pluginsCount - buildStartPlugins.length} failed`)}, ${pluginsCount} total`,
169
+ plugins: status === "success" ? `${pc3.green(`${buildStartPlugins.length} successful`)}, ${pluginsCount} total` : `${pc3.red(`${pluginsCount - buildStartPlugins.length + 1} failed`)}, ${pluginsCount} total`,
179
170
  filesCreated: files.length,
180
171
  time: pc3.yellow(`${elapsedSeconds}s`),
181
172
  output: pathParser.resolve(config.root, config.output.path)
182
173
  };
183
- console.log(`
174
+ if (options.debug) {
175
+ logs.push(pc3.bold("Generated files:\n"));
176
+ logs.push(files.map((file) => `${pc3.blue(file.meta?.pluginName)} ${file.path}`).join("\n"));
177
+ }
178
+ logs.push(`
179
+
184
180
  ${pc3.bold("Plugins:")} ${meta.plugins}
185
181
  ${pc3.bold("Generated:")} ${meta.filesCreated} files
186
182
  ${pc3.bold("Time:")} ${meta.time}
187
183
  ${pc3.bold("Output:")} ${meta.output}
188
- `);
189
- if (options.debug) {
190
- console.log(`${pc3.bold("Generated files:")}`);
191
- console.log(`${files.map((file) => `${pc3.blue(file.meta?.pluginName)} ${file.path}`).join("\n")}`);
192
- }
193
- };
194
- const printErrors = (error) => {
195
- const pe = new PrettyError();
196
- if (options.debug) {
197
- spinner2.fail(pc3.red(`Something went wrong
198
-
199
- `));
200
- const causedError = error?.cause;
201
- console.log(pe.render(error));
202
- if (causedError) {
203
- console.log(pe.render(causedError));
204
- }
205
- } else {
206
- spinner2.fail(pc3.red(`Something went wrong
207
-
208
- ${error?.message}`));
209
- }
184
+
185
+ `);
186
+ return logs;
210
187
  };
211
188
  try {
212
189
  const { root, ...userConfig } = config;
213
190
  const logLevel = options.logLevel ?? userConfig.logLevel ?? "silent";
214
191
  const inputPath = options.input ?? userConfig.input.path;
215
- spinner2.start(parseText(`\u{1F680} Building`, { info: `(${pc3.dim(inputPath)})` }, logLevel));
192
+ spinner.start(parseText(`\u{1F680} Building`, { info: `(${pc3.dim(inputPath)})` }, logLevel));
216
193
  const output = await build({
217
194
  config: {
218
195
  root: process.cwd(),
@@ -229,19 +206,16 @@ ${error?.message}`));
229
206
  },
230
207
  logger
231
208
  });
232
- spinner2.succeed(parseText(`\u{1F680} Build completed`, { info: `(${pc3.dim(inputPath)})` }, logLevel));
209
+ spinner.succeed(parseText(`\u{1F680} Build completed`, { info: `(${pc3.dim(inputPath)})` }, logLevel));
233
210
  await onDone(config.hooks, logLevel);
234
- printSummary(output.pluginManager, "success");
211
+ const summary = getSummary(output.pluginManager, "success");
212
+ console.log(summary.join(""));
235
213
  } catch (error) {
236
- if (error instanceof ParallelPluginError) {
237
- error.errors.map((e) => printErrors(e));
238
- } else {
239
- printErrors(error);
240
- }
241
214
  if (error instanceof PluginError || error instanceof ParallelPluginError) {
242
- printSummary(error.pluginManager, "failed");
215
+ const summary = getSummary(error.pluginManager, "failed");
216
+ throw new SummaryError("Something went wrong\n", { cause: error, summary });
243
217
  }
244
- throw error;
218
+ throw new SummaryError("Something went wrong\n", { cause: error });
245
219
  }
246
220
  }
247
221
  var SLASHES = /* @__PURE__ */ new Set(["/", "\\"]);
@@ -309,8 +283,7 @@ async function getConfig(result, options) {
309
283
  };
310
284
  return JSONConfig;
311
285
  }
312
- async function startWatcher(cb, options) {
313
- const { spinner: spinner2, path } = options;
286
+ async function startWatcher(path, cb) {
314
287
  const { watch } = await import('chokidar');
315
288
  const ignored = ["**/{.git,node_modules}/**"];
316
289
  const watcher = watch(path, {
@@ -318,12 +291,12 @@ async function startWatcher(cb, options) {
318
291
  ignored
319
292
  });
320
293
  watcher.on("all", (type, file) => {
321
- spinner2.succeed(pc3.yellow(pc3.bold(`Change detected: ${type} ${file}`)));
322
- spinner2.spinner = "clock";
294
+ spinner.succeed(pc3.yellow(pc3.bold(`Change detected: ${type} ${file}`)));
295
+ spinner.spinner = "clock";
323
296
  try {
324
- cb(options.path);
297
+ cb(path);
325
298
  } catch (e) {
326
- spinner2.warn(pc3.red("Watcher failed"));
299
+ spinner.warn(pc3.red("Watcher failed"));
327
300
  }
328
301
  });
329
302
  }
@@ -346,7 +319,6 @@ var tsLoader = (configFile) => {
346
319
  throw new Error(`'ts-node' is required for the TypeScript configuration files. Make sure it is installed
347
320
  Error: ${err.message}`);
348
321
  }
349
- console.log(err);
350
322
  throw err;
351
323
  } finally {
352
324
  registerer.enabled();
@@ -361,12 +333,10 @@ async function getCosmiConfig(moduleName2, config) {
361
333
  `.${moduleName2}rc.json`,
362
334
  `.${moduleName2}rc.yaml`,
363
335
  `.${moduleName2}rc.yml`,
364
- // TODO fix tsLoader
365
336
  `.${moduleName2}rc.ts`,
366
337
  `.${moduleName2}rc.js`,
367
338
  `.${moduleName2}rc.cjs`,
368
339
  `.${moduleName2}rc.mjs`,
369
- // TODO fix tsLoader
370
340
  `${moduleName2}.config.ts`,
371
341
  `${moduleName2}.config.js`,
372
342
  `${moduleName2}.config.cjs`,
@@ -388,14 +358,58 @@ async function getCosmiConfig(moduleName2, config) {
388
358
  }
389
359
  return result;
390
360
  }
391
-
392
- // src/index.ts
361
+ var prettyError = new PrettyError().skipPackage("commander").skip(function(traceLine, lineNumber) {
362
+ const pattern = new RegExp("renderErrors");
363
+ const hasMatch = traceLine?.file?.match(pattern);
364
+ if (typeof traceLine.packageName !== "undefined" && hasMatch) {
365
+ return true;
366
+ }
367
+ }).start();
368
+ function getErrorCauses(errors) {
369
+ return errors.reduce((prev, error) => {
370
+ const causedError = error?.cause;
371
+ if (causedError) {
372
+ prev = [...prev, ...getErrorCauses([causedError])];
373
+ }
374
+ prev = [...prev, prettyError.render(error)];
375
+ return prev;
376
+ }, []).filter(Boolean);
377
+ }
378
+ function renderErrors(error, { prefixText, debug = false }) {
379
+ if (!error) {
380
+ return "";
381
+ }
382
+ if (error instanceof ParallelPluginError) {
383
+ return [prefixText, ...error.errors.map((e) => renderErrors(e, { debug }))].filter(Boolean).join("\n");
384
+ }
385
+ if (debug) {
386
+ const errors = getErrorCauses([error]);
387
+ return [prefixText, ...errors].filter(Boolean).join("\n");
388
+ }
389
+ prettyError.skipNodeFiles();
390
+ prettyError.skip(function() {
391
+ return true;
392
+ });
393
+ return [prefixText, prettyError.render(error.message)].filter(Boolean).join("\n");
394
+ }
393
395
  var moduleName = "kubb";
394
396
  var spinner = ora({
395
397
  spinner: "clock"
396
- }).start();
397
- var program = new Command(moduleName).description("Kubb").action(async (options) => {
398
+ });
399
+ var program = new Command(moduleName).name(moduleName).description("Kubb").version(version, "-v").exitOverride((err) => {
400
+ if (err instanceof CommanderError) {
401
+ process.exit(1);
402
+ }
403
+ }).configureOutput({
404
+ outputError: (message, write2) => {
405
+ const options = program.opts();
406
+ write2(
407
+ renderErrors(new Error(message, { cause: void 0 }), { debug: options.debug, prefixText: pc3.red("Something went wrong with processing the CLI\n") }) + "\n"
408
+ );
409
+ }
410
+ }).action(async (options) => {
398
411
  try {
412
+ spinner.start();
399
413
  if (options.init) {
400
414
  spinner.start("\u{1F4E6} Initializing Kubb");
401
415
  await init({ spinner, logLevel: options.logLevel });
@@ -407,23 +421,33 @@ var program = new Command(moduleName).description("Kubb").action(async (options)
407
421
  spinner.succeed(`\u{1F4BE} Config loaded(${pc3.dim(pathParser.relative(process.cwd(), result.filepath))})`);
408
422
  if (options.watch) {
409
423
  const config = await getConfig(result, options);
410
- startWatcher(
411
- async (paths) => {
412
- await run({ config, spinner, options });
413
- spinner.spinner = "simpleDotsScrolling";
414
- spinner.start(pc3.yellow(pc3.bold(`Watching for changes in ${paths.join(" and ")}`)));
415
- },
416
- {
417
- spinner,
418
- path: [config.input.path]
419
- }
420
- );
424
+ startWatcher([config.input.path], async (paths) => {
425
+ await run({ config, options });
426
+ spinner.spinner = "simpleDotsScrolling";
427
+ spinner.start(pc3.yellow(pc3.bold(`Watching for changes in ${paths.join(" and ")}`)));
428
+ });
421
429
  } else {
422
430
  const config = await getConfig(result, options);
423
- await run({ config, spinner, options });
431
+ await run({ config, options });
424
432
  }
425
433
  } catch (e) {
434
+ const originalError = e;
435
+ let error = originalError;
436
+ const summaryError = error instanceof SummaryError ? error : void 0;
437
+ if (summaryError) {
438
+ error = summaryError.cause;
439
+ }
440
+ const message = renderErrors(error, { debug: options.debug, prefixText: pc3.red(originalError?.message) });
441
+ spinner.fail([message, ...summaryError?.summary || []].join("\n"));
426
442
  process.exit(1);
427
443
  }
428
444
  }).addOption(new Option("-c, --config <path>", "Path to the Kubb config")).addOption(new Option("-i, --input <path>", "Path of the input file(overrides the one in `kubb.config.js`)")).addOption(new Option("-l, --logLevel <type>", "Type of the logging(overrides the one in `kubb.config.js`)").choices(["error", "info", "silent"])).addOption(new Option("--init", "Init Kubb")).addOption(new Option("-d, --debug", "Debug mode").default(false)).addOption(new Option("-w, --watch", "Watch mode based on the input file"));
429
- program.name(moduleName).description("Generate").version(version, "-v").parse();
445
+
446
+ // src/index.ts
447
+ function runCLI(argv) {
448
+ return program.parse(argv);
449
+ }
450
+
451
+ export { runCLI as default };
452
+ //# sourceMappingURL=out.js.map
453
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/program.ts","../package.json","../src/init.ts","../src/run.ts","../src/utils/parseHrtimeToSeconds.ts","../src/utils/parseText.ts","../src/utils/OraWritable.ts","../src/utils/getConfig.ts","../src/utils/importModule.ts","../src/utils/getPlugins.ts","../src/utils/watcher.ts","../src/utils/getCosmiConfig.ts","../src/utils/renderErrors.ts","../src/index.ts"],"names":["pathPar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A,EACF,SAAS,GAAP;AACA,UAAM,gBAAgB;AACtB,QAAI,QAAQ;AACZ,UAAM,eAAe,iBAAiBK,gBAAe,QAAQ;AAE7D,QAAI,cAAc;AAEhB,cAAQ,aAAa;AAAA,IACvB;AAEA,UAAM,UAAU,aAAa,OAAO,EAAE,OAAO,QAAQ,OAAO,YAAYL,IAAG,IAAI,eAAe,OAAO,EAAE,CAAC;AAExG,YAAQ,KAAK,CAAC,SAAS,GAAI,cAAc,WAAW,CAAC,CAAE,EAAE,KAAK,IAAI,CAAC;AACnE,YAAQ,KAAK,CAAC;AAAA,EAChB;AACF,CAAC,EACA,UAAU,IAAI,OAAO,uBAAuB,yBAAyB,CAAC,EACtE,UAAU,IAAI,OAAO,sBAAsB,+DAA+D,CAAC,EAC3G,UAAU,IAAI,OAAO,yBAAyB,4DAA4D,EAAE,QAAQ,CAAC,SAAS,QAAQ,QAAQ,CAAC,CAAC,EAChJ,UAAU,IAAI,OAAO,UAAU,WAAW,CAAC,EAC3C,UAAU,IAAI,OAAO,eAAe,YAAY,EAAE,QAAQ,KAAK,CAAC,EAChE,UAAU,IAAI,OAAO,eAAe,oCAAoC,CAAC;;;AavF7D,SAAR,OAAwB,MAAmC;AAChE,SAAO,QAAQ,MAAM,IAAI;AAC3B","sourcesContent":["import pathParser from 'node:path'\n\nimport { Command, CommanderError, Option } from 'commander'\nimport ora from 'ora'\nimport pc from 'picocolors'\n\nimport { version } from '../package.json'\nimport { init } from './init.ts'\nimport { run } from './run.ts'\nimport { getConfig, getCosmiConfig, renderErrors, startWatcher } from './utils/index.ts'\n\nimport { SummaryError } from '@kubb/core'\nimport type { CLIOptions } from '@kubb/core'\n\nconst moduleName = 'kubb'\n\nexport const spinner = ora({\n spinner: 'clock',\n})\n\nexport const program = new Command(moduleName)\n .name(moduleName)\n .description('Kubb')\n .version(version, '-v')\n .exitOverride((err) => {\n if (err instanceof CommanderError) {\n process.exit(1)\n }\n })\n .configureOutput({\n outputError: (message, write) => {\n const options: CLIOptions = program.opts()\n\n write(\n renderErrors(new Error(message, { cause: undefined }), { debug: options.debug, prefixText: pc.red('Something went wrong with processing the CLI\\n') }) +\n '\\n'\n )\n },\n })\n .action(async (options: CLIOptions) => {\n try {\n spinner.start()\n\n if (options.init) {\n spinner.start('📦 Initializing Kubb')\n await init({ spinner, logLevel: options.logLevel })\n spinner.succeed(`📦 initialized Kubb`)\n return\n }\n\n // CONFIG\n spinner.start('💾 Loading config')\n const result = await getCosmiConfig(moduleName, options.config)\n spinner.succeed(`💾 Config loaded(${pc.dim(pathParser.relative(process.cwd(), result.filepath))})`)\n\n // END CONFIG\n\n if (options.watch) {\n const config = await getConfig(result, options)\n\n startWatcher([config.input.path], async (paths) => {\n await run({ config, options })\n spinner.spinner = 'simpleDotsScrolling'\n spinner.start(pc.yellow(pc.bold(`Watching for changes in ${paths.join(' and ')}`)))\n })\n } else {\n const config = await getConfig(result, options)\n\n await run({ config, options })\n }\n } catch (e: any) {\n const originalError = e as Error\n let error = originalError\n const summaryError = error instanceof SummaryError ? error : undefined\n\n if (summaryError) {\n // use the real error from summaryError and use the case of SummaryError to display a summary of plugins that failed\n error = summaryError.cause as Error\n }\n\n const message = renderErrors(error, { debug: options.debug, prefixText: pc.red(originalError?.message) })\n\n spinner.fail([message, ...(summaryError?.summary || [])].join('\\n'))\n process.exit(1)\n }\n })\n .addOption(new Option('-c, --config <path>', 'Path to the Kubb config'))\n .addOption(new Option('-i, --input <path>', 'Path of the input file(overrides the one in `kubb.config.js`)'))\n .addOption(new Option('-l, --logLevel <type>', 'Type of the logging(overrides the one in `kubb.config.js`)').choices(['error', 'info', 'silent']))\n .addOption(new Option('--init', 'Init Kubb'))\n .addOption(new Option('-d, --debug', 'Debug mode').default(false))\n .addOption(new Option('-w, --watch', 'Watch mode based on the input file'))\n","{\n \"name\": \"@kubb/cli\",\n \"version\": \"1.1.13\",\n \"description\": \"Generator cli\",\n \"keywords\": [\n \"typescript\",\n \"plugins\",\n \"kubb\",\n \"codegen\",\n \"cli\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"git://github.com/kubb-project/kubb.git\",\n \"directory\": \"packages/cli\"\n },\n \"license\": \"MIT\",\n \"author\": \"Stijn Van Hulle <stijn@stijnvanhulle.be\",\n \"sideEffects\": false,\n \"type\": \"module\",\n \"main\": \"dist/index.js\",\n \"module\": \"dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"bin\": {\n \"kubb\": \"bin/kubb.js\"\n },\n \"files\": [\n \"dist\",\n \"bin\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"rimraf ./dist\",\n \"lint\": \"eslint \\\"**/*.{ts,tsx}\\\"\",\n \"lint-fix\": \"bun run lint --quiet --fix\",\n \"release\": \"pnpm publish --no-git-check\",\n \"start\": \"tsup --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\",\n \"upgrade\": \"pnpm update\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@swc/core\": \"^1.3.63\",\n \"chokidar\": \"^3.5.3\",\n \"commander\": \"^10.0.1\",\n \"cosmiconfig\": \"^8.2.0\",\n \"execa\": \"^7.1.1\",\n \"ora\": \"^6.3.1\",\n \"picocolors\": \"^1.0.0\",\n \"pretty-error\": \"^4.0.0\",\n \"string-argv\": \"^0.3.2\",\n \"ts-node\": \"^10.9.1\",\n \"yaml\": \"^2.3.1\"\n },\n \"devDependencies\": {\n \"@kubb/swagger\": \"workspace:*\",\n \"@kubb/ts-config\": \"workspace:*\",\n \"@kubb/tsup-config\": \"workspace:*\",\n \"source-map-support\": \"^0.5.19\",\n \"@types/node\": \"^20.3.1\",\n \"tsup\": \"^6.7.0\",\n \"typescript\": \"^5.1.3\"\n },\n \"packageManager\": \"pnpm@8.3.0\",\n \"engines\": {\n \"node\": \">=18\",\n \"pnpm\": \">=8.3.0\"\n },\n \"preferGlobal\": true,\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","import pathParser from 'node:path'\n\nimport { write } from '@kubb/core'\n\nimport { $ } from 'execa'\nimport pc from 'picocolors'\n\nimport type { LogLevel } from '@kubb/core'\nimport type { Ora } from 'ora'\n\nexport type Preset = 'simple'\n\nexport type PackageManager = 'pnpm' | 'npm' | 'yarn'\n\nexport type PresetMeta = {\n 'kubb.config': string\n packages: string[]\n}\n\ntype RunProps = {\n spinner: Ora\n /**\n * @default `'silent'`\n */\n logLevel?: LogLevel\n /**\n * @default `'simple'`\n */\n preset?: Preset\n /**\n * @default `'pnpm'`\n */\n packageManager?: PackageManager\n}\n\nconst presets: Record<Preset, PresetMeta> = {\n simple: {\n 'kubb.config': `\nimport { defineConfig } from '@kubb/core'\nimport createSwagger from '@kubb/swagger'\nimport createSwaggerTS from '@kubb/swagger-ts'\nimport createSwaggerTanstackQuery from '@kubb/swagger-tanstack-query'\n\nexport default defineConfig({\n root: '.',\n input: {\n path: 'https://petstore3.swagger.io/api/v3/openapi.json',\n },\n output: {\n path: './src/gen',\n clean: true,\n },\n hooks: {\n done: 'echo \"🎉 done\"',\n },\n logLevel: 'info',\n plugins: [createSwagger({}), createSwaggerTS({ output: 'models', enumType: 'enum' }), createSwaggerTanstackQuery({ output: './hooks' })],\n})\n `,\n packages: ['@kubb/core', '@kubb/cli', '@kubb/swagger', '@kubb/swagger-ts', '@kubb/swagger-tanstack-query'],\n },\n}\n\nexport async function init({ spinner, preset = 'simple', logLevel = 'silent', packageManager = 'pnpm' }: RunProps): Promise<void> {\n const presetMeta = presets[preset]\n const path = pathParser.resolve(process.cwd(), './kubb.config.js')\n const installCommand = packageManager === 'npm' ? 'install' : 'add'\n\n spinner.start(`📀 Writing \\`kubb.config.js\\` ${pc.dim(path)}`)\n await write(presetMeta['kubb.config'], path)\n spinner.succeed(`📀 Wrote \\`kubb.config.js\\` ${pc.dim(path)}`)\n\n const data = await Promise.all([\n $`npm init es6 -y`,\n ...presetMeta.packages.map(async (pack) => {\n spinner.start(`📀 Installing ${pc.dim(pack)}`)\n const { stdout } = await $({ preferLocal: false })`${packageManager} ${installCommand} ${pack}`\n spinner.succeed(`📀 Installed ${pc.dim(pack)}`)\n\n return stdout\n }),\n ])\n\n if (logLevel === 'info') {\n data.forEach((text) => console.log(text))\n }\n}\n","import pathParser from 'node:path'\n\nimport { build, throttle, ParallelPluginError, PluginError, SummaryError, timeout } from '@kubb/core'\n\nimport { execa } from 'execa'\nimport pc from 'picocolors'\n\nimport { parseArgsStringToArgv } from 'string-argv'\n\nimport { parseHrtimeToSeconds } from './utils/parseHrtimeToSeconds.ts'\nimport { parseText } from './utils/parseText.ts'\n\nimport type { BuildOutput, CLIOptions, KubbConfig, Logger, LogLevel } from '@kubb/core'\nimport { OraWritable } from './utils/OraWritable.ts'\nimport { spinner } from './program.ts'\n\ntype RunProps = {\n config: KubbConfig\n options: CLIOptions\n}\n\nexport async function run({ config, options }: RunProps): Promise<void> {\n const hrstart = process.hrtime()\n const [log] = throttle<void, Parameters<Logger['log']>>((message, { logLevel, params }) => {\n if (logLevel === 'error') {\n throw new Error(message || 'Something went wrong')\n } else if (logLevel === 'info') {\n if (message) {\n spinner.text = message\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n spinner.text = `🪂 Executing ${params?.hookName || 'unknown'}(${pc.yellow(params?.pluginName || 'unknown')})`\n }\n }\n }, 100)\n const logger: Logger = {\n log,\n spinner,\n }\n\n const onDone = async (hooks: KubbConfig['hooks'], logLevel: LogLevel) => {\n if (!hooks?.done) {\n return\n }\n\n let commands: string[] = []\n if (typeof hooks?.done === 'string') {\n commands = [hooks.done]\n } else {\n commands = hooks.done\n }\n\n const promises = commands.map(async (command) => {\n const oraWritable = new OraWritable(spinner, command)\n const [cmd, ..._args] = [...parseArgsStringToArgv(command)]\n spinner.start(parseText(`🪂 Executing hooks(${pc.yellow('done')})`, { info: ` ${pc.dim(command)}` }, logLevel))\n\n const { stdout } = await execa(cmd, _args, {}).pipeStdout!(oraWritable)\n spinner.suffixText = ''\n oraWritable.destroy()\n // wait for 50ms to be sure\n await timeout(50)\n\n if (logLevel === 'info') {\n spinner.succeed(parseText(`🪂 Executing hooks(${pc.yellow('done')})`, { info: ` ${pc.dim(command)}` }, logLevel))\n\n console.log(stdout)\n }\n })\n\n await Promise.all(promises)\n\n if (logLevel === 'silent') {\n spinner.succeed(parseText(`🪂 Executing hooks(${pc.yellow('done')})`, {}, logLevel))\n }\n }\n\n const getSummary = (pluginManager: BuildOutput['pluginManager'], status: 'success' | 'failed'): string[] => {\n const logs: string[] = []\n const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrstart))\n\n const buildStartPlugins = [\n ...new Set(pluginManager.executed.filter((item) => item.hookName === 'buildStart' && item.plugin.name !== 'core').map((item) => item.plugin.name)),\n ]\n const pluginsCount = config.plugins?.length || 0\n const files = pluginManager.fileManager.files.sort((a, b) => {\n if (!a.meta?.pluginName || !b.meta?.pluginName) {\n return 0\n }\n if (a.meta?.pluginName.length < b.meta?.pluginName.length) {\n return 1\n }\n if (a.meta?.pluginName.length > b.meta?.pluginName.length) {\n return -1\n }\n return 0\n })\n\n const meta = {\n plugins:\n status === 'success'\n ? `${pc.green(`${buildStartPlugins.length} successful`)}, ${pluginsCount} total`\n : `${pc.red(`${pluginsCount - buildStartPlugins.length + 1} failed`)}, ${pluginsCount} total`,\n filesCreated: files.length,\n time: pc.yellow(`${elapsedSeconds}s`),\n output: pathParser.resolve(config.root, config.output.path),\n } as const\n\n if (options.debug) {\n logs.push(pc.bold('Generated files:\\n'))\n logs.push(files.map((file) => `${pc.blue(file.meta?.pluginName)} ${file.path}`).join('\\n'))\n }\n\n logs.push(`\\n\n ${pc.bold('Plugins:')} ${meta.plugins}\n${pc.bold('Generated:')} ${meta.filesCreated} files\n ${pc.bold('Time:')} ${meta.time}\n ${pc.bold('Output:')} ${meta.output}\n \\n`)\n\n return logs\n }\n\n try {\n const { root, ...userConfig } = config\n const logLevel = options.logLevel ?? userConfig.logLevel ?? 'silent'\n const inputPath = options.input ?? userConfig.input.path\n\n spinner.start(parseText(`🚀 Building`, { info: `(${pc.dim(inputPath)})` }, logLevel))\n\n const output = await build({\n config: {\n root: process.cwd(),\n ...userConfig,\n logLevel,\n input: {\n ...userConfig.input,\n path: inputPath,\n },\n output: {\n write: true,\n ...userConfig.output,\n },\n },\n logger,\n })\n\n spinner.succeed(parseText(`🚀 Build completed`, { info: `(${pc.dim(inputPath)})` }, logLevel))\n\n await onDone(config.hooks, logLevel)\n\n const summary = getSummary(output.pluginManager, 'success')\n console.log(summary.join(''))\n } catch (error: any) {\n if (error instanceof PluginError || error instanceof ParallelPluginError) {\n const summary = getSummary(error.pluginManager, 'failed')\n\n throw new SummaryError('Something went wrong\\n', { cause: error, summary })\n }\n\n throw new SummaryError('Something went wrong\\n', { cause: error })\n }\n}\n","export function parseHrtimeToSeconds(hrtime: [number, number]) {\n const seconds = (hrtime[0] + hrtime[1] / 1e9).toFixed(3)\n return seconds\n}\n","import type { LogLevel } from '@kubb/core'\n\nexport function parseText(baseText: string, config: Partial<Record<LogLevel, string>>, logLevel: LogLevel = 'silent') {\n return `${baseText}${config[logLevel] || ''}`\n}\n","import type { WritableOptions } from 'node:stream'\nimport { Writable } from 'node:stream'\nimport type { Ora } from 'ora'\nimport pc from 'picocolors'\n\nexport class OraWritable extends Writable {\n public command: string\n public spinner: Ora\n constructor(spinner: Ora, command: string, opts?: WritableOptions) {\n super(opts)\n\n this.command = command\n this.spinner = spinner\n }\n _write(chunk: any, _encoding: NodeJS.BufferEncoding, callback: (error?: Error | null) => void) {\n this.spinner.suffixText = `\\n\\n${pc.bold(pc.blue(this.command))}: ${chunk?.toString()}`\n\n callback()\n }\n}\n","import { isPromise } from '@kubb/core'\n\nimport { getPlugins } from './getPlugins.ts'\n\nimport type { CLIOptions, KubbConfig, KubbUserConfig } from '@kubb/core'\nimport type { CosmiconfigResult } from '../types.ts'\n\nexport async function getConfig(result: CosmiconfigResult, options: CLIOptions): Promise<KubbConfig> {\n const config = result?.config\n let kubbUserConfig: Promise<KubbUserConfig> = Promise.resolve(config) as Promise<KubbUserConfig>\n\n // for ts or js files\n if (typeof config === 'function') {\n const possiblePromise = config(options)\n if (isPromise(possiblePromise)) {\n kubbUserConfig = possiblePromise\n }\n kubbUserConfig = Promise.resolve(possiblePromise)\n }\n\n let JSONConfig = await kubbUserConfig\n JSONConfig = {\n ...JSONConfig,\n plugins: JSONConfig.plugins ? await getPlugins(JSONConfig.plugins) : undefined,\n }\n\n return JSONConfig as KubbConfig\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport mod from 'node:module'\nimport { pathToFileURL } from 'node:url'\n\nconst SLASHES = new Set(['/', '\\\\'])\n\n/**\n * Normalizes directories to have a trailing slash.\n * Resolve is pretty finicky -- if the directory name doesn't have\n * a trailing slash then it tries to look in the parent directory.\n * i.e., if the directory is \"/usr/nzakas/foo\" it will start the\n * search in /usr/nzakas. However, if the directory is \"/user/nzakas/foo/\",\n * then it will start the search in /user/nzakas/foo.\n * @param {string} directory The directory to check.\n * @returns {string} The normalized directory.\n */\nexport function normalizeDirectory(directory: string) {\n if (!SLASHES.has(directory[directory.length - 1])) {\n return `${directory}/`\n }\n\n return directory\n}\n\nexport async function importModule(path: string, cwd?: string): Promise<any> {\n let location = path\n\n if (cwd) {\n const require = mod.createRequire(normalizeDirectory(cwd))\n location = require.resolve(path)\n }\n\n const module = await import(pathToFileURL(location).href)\n\n return module?.default ?? module\n}\n","// eslint-disable-next-line @typescript-eslint/ban-ts-comment\n// @ts-nocheck\n\nimport { importModule } from './importModule.ts'\n\nimport type { KubbJSONPlugin, KubbObjectPlugin, KubbUserConfig } from '@kubb/core'\n\nfunction isJSONPlugins(plugins: KubbUserConfig['plugins'] | KubbJSONPlugin[]): plugins is KubbJSONPlugin[] {\n return !!(plugins as KubbJSONPlugin[])?.some((plugin) => {\n return typeof plugin?.[0] === 'string'\n })\n}\n\nfunction isObjectPlugins(plugins: KubbUserConfig['plugins'] | KubbJSONPlugin[]): plugins is KubbObjectPlugin {\n return plugins instanceof Object && !Array.isArray(plugins)\n}\n\nasync function importPlugin(name: string, options: object) {\n const importedPlugin = process.env.NODE_ENV === 'test' ? await import(name) : await importModule(name, process.cwd())\n\n return importedPlugin?.default ? importedPlugin.default(options) : importedPlugin(options)\n}\n\nexport function getPlugins(plugins: KubbUserConfig['plugins'] | KubbJSONPlugin[]): Promise<KubbUserConfig['plugins']> {\n if (isObjectPlugins(plugins)) {\n const promises = Object.keys(plugins).map(async (name) => {\n return importPlugin(name, plugins[name as keyof typeof plugins])\n })\n return Promise.all(promises)\n }\n\n if (isJSONPlugins(plugins)) {\n const promises = plugins.map(async (plugin) => {\n const [name, options = {}] = plugin\n return importPlugin(name, options)\n })\n return Promise.all(promises)\n }\n return Promise.resolve(plugins)\n}\n","import pc from 'picocolors'\n\nimport { spinner } from '../program'\n\nexport async function startWatcher(path: string[], cb: (path: string[]) => Promise<void>) {\n const { watch } = await import('chokidar')\n\n const ignored = ['**/{.git,node_modules}/**']\n\n const watcher = watch(path, {\n ignorePermissionErrors: true,\n ignored,\n })\n watcher.on('all', (type, file) => {\n spinner.succeed(pc.yellow(pc.bold(`Change detected: ${type} ${file}`)))\n // revert back\n spinner.spinner = 'clock'\n\n try {\n cb(path)\n } catch (e) {\n spinner.warn(pc.red('Watcher failed'))\n }\n })\n}\n","/* eslint-disable @typescript-eslint/no-unsafe-return */\nimport { cosmiconfig } from 'cosmiconfig'\nimport tsNode from 'ts-node'\nimport yaml from 'yaml'\n\nimport { importModule } from './importModule.ts'\n\nimport type { CosmiconfigResult } from '../types.ts'\n\nconst jsLoader = async (configFile: string) => {\n return importModule(configFile)\n}\n// TODO fix tsLoader for node 20 when using ESM only\n// https://github.com/TypeStrong/ts-node/issues/1997\nconst tsLoader = (configFile: string) => {\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n let registerer = { enabled() {} }\n\n try {\n // Register TypeScript compiler instance\n registerer = tsNode.register({\n compilerOptions: { module: 'commonjs' },\n swc: true,\n typeCheck: false,\n })\n\n const module = require(configFile)\n\n return module.default\n } catch (err: any) {\n if (err.code === 'MODULE_NOT_FOUND') {\n throw new Error(`'ts-node' is required for the TypeScript configuration files. Make sure it is installed\\nError: ${err.message}`)\n }\n\n throw err\n } finally {\n registerer.enabled()\n }\n}\n\nexport async function getCosmiConfig(moduleName: string, config?: string) {\n const explorer = cosmiconfig(moduleName, {\n cache: false,\n searchPlaces: [\n 'package.json',\n `.${moduleName}rc`,\n `.${moduleName}rc.json`,\n `.${moduleName}rc.yaml`,\n `.${moduleName}rc.yml`,\n\n `.${moduleName}rc.ts`,\n `.${moduleName}rc.js`,\n `.${moduleName}rc.cjs`,\n `.${moduleName}rc.mjs`,\n\n `${moduleName}.config.ts`,\n `${moduleName}.config.js`,\n `${moduleName}.config.cjs`,\n `${moduleName}.config.mjs`,\n ],\n loaders: {\n '.yaml': (filepath, content) => yaml.parse(content),\n '.yml': (filepath, content) => yaml.parse(content),\n '.js': jsLoader,\n '.cjs': jsLoader,\n '.mjs': jsLoader,\n '.ts': tsLoader,\n noExt: jsLoader,\n },\n })\n\n const result = config ? await explorer.load(config) : await explorer.search()\n\n if (result?.isEmpty || !result || !result.config) {\n throw new Error('Config not defined, create a kubb.config.js or pass through your config with the option --config')\n }\n\n return result as CosmiconfigResult\n}\n","import { ParallelPluginError } from '@kubb/core'\nimport PrettyError from 'pretty-error'\n\nexport const prettyError = new PrettyError()\n .skipPackage('commander')\n .skip(function (traceLine, lineNumber) {\n // exclude renderErrors.ts\n const pattern = new RegExp('renderErrors')\n\n const hasMatch = traceLine?.file?.match(pattern)\n\n if (typeof traceLine.packageName !== 'undefined' && hasMatch) {\n return true\n }\n } as PrettyError.Callback)\n .start()\n\nfunction getErrorCauses(errors: Error[]): string[] {\n return errors\n .reduce((prev, error) => {\n const causedError = error?.cause as Error\n if (causedError) {\n prev = [...prev, ...getErrorCauses([causedError])]\n }\n prev = [...prev, prettyError.render(error)]\n\n return prev\n }, [] as string[])\n .filter(Boolean)\n}\n\nexport function renderErrors(error: Error | undefined, { prefixText, debug = false }: { prefixText?: string; debug?: boolean }): string {\n if (!error) {\n return ''\n }\n\n if (error instanceof ParallelPluginError) {\n return [prefixText, ...error.errors.map((e) => renderErrors(e, { debug }))].filter(Boolean).join('\\n')\n }\n\n if (debug) {\n const errors = getErrorCauses([error])\n\n return [prefixText, ...errors].filter(Boolean).join('\\n')\n }\n\n // skip when no debug is set\n prettyError.skipNodeFiles()\n prettyError.skip(function () {\n return true\n } as PrettyError.Callback)\n\n return [prefixText, prettyError.render(error.message)].filter(Boolean).join('\\n')\n}\n","import type { Command } from 'commander'\n\nimport { program } from './program.ts'\n\nexport default function runCLI(argv?: readonly string[]): Command {\n return program.parse(argv)\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/cli",
3
- "version": "1.1.11",
3
+ "version": "1.1.13",
4
4
  "description": "Generator cli",
5
5
  "keywords": [
6
6
  "typescript",
@@ -27,12 +27,11 @@
27
27
  "files": [
28
28
  "dist",
29
29
  "bin",
30
- "src",
31
30
  "!/**/**.test.**",
32
31
  "!/**/__tests__/**"
33
32
  ],
34
33
  "dependencies": {
35
- "@swc/core": "^1.3.62",
34
+ "@swc/core": "^1.3.63",
36
35
  "chokidar": "^3.5.3",
37
36
  "commander": "^10.0.1",
38
37
  "cosmiconfig": "^8.2.0",
@@ -43,13 +42,14 @@
43
42
  "string-argv": "^0.3.2",
44
43
  "ts-node": "^10.9.1",
45
44
  "yaml": "^2.3.1",
46
- "@kubb/core": "1.1.11"
45
+ "@kubb/core": "1.1.13"
47
46
  },
48
47
  "devDependencies": {
49
- "@types/node": "^20.3.0",
48
+ "source-map-support": "^0.5.19",
49
+ "@types/node": "^20.3.1",
50
50
  "tsup": "^6.7.0",
51
51
  "typescript": "^5.1.3",
52
- "@kubb/swagger": "1.1.11",
52
+ "@kubb/swagger": "1.1.13",
53
53
  "@kubb/ts-config": "0.1.0",
54
54
  "@kubb/tsup-config": "1.1.8"
55
55
  },
package/src/index.ts DELETED
@@ -1,69 +0,0 @@
1
- #!/usr/bin/env node
2
- import pathParser from 'node:path'
3
-
4
- import { Command, Option } from 'commander'
5
- import ora from 'ora'
6
- import pc from 'picocolors'
7
-
8
- import { version } from '../package.json'
9
- import { init } from './init.ts'
10
- import { run } from './run.ts'
11
- import { getConfig, getCosmiConfig, startWatcher } from './utils/index.ts'
12
-
13
- import type { CLIOptions } from '@kubb/core'
14
-
15
- const moduleName = 'kubb'
16
-
17
- const spinner = ora({
18
- spinner: 'clock',
19
- }).start()
20
-
21
- const program = new Command(moduleName)
22
- .description('Kubb')
23
- .action(async (options: CLIOptions) => {
24
- try {
25
- if (options.init) {
26
- spinner.start('📦 Initializing Kubb')
27
- await init({ spinner, logLevel: options.logLevel })
28
- spinner.succeed(`📦 initialized Kubb`)
29
- return
30
- }
31
-
32
- // CONFIG
33
- spinner.start('💾 Loading config')
34
- const result = await getCosmiConfig(moduleName, options.config)
35
- spinner.succeed(`💾 Config loaded(${pc.dim(pathParser.relative(process.cwd(), result.filepath))})`)
36
-
37
- // END CONFIG
38
-
39
- if (options.watch) {
40
- const config = await getConfig(result, options)
41
-
42
- startWatcher(
43
- async (paths) => {
44
- await run({ config, spinner, options })
45
- spinner.spinner = 'simpleDotsScrolling'
46
- spinner.start(pc.yellow(pc.bold(`Watching for changes in ${paths.join(' and ')}`)))
47
- },
48
- {
49
- spinner,
50
- path: [config.input.path],
51
- }
52
- )
53
- } else {
54
- const config = await getConfig(result, options)
55
-
56
- await run({ config, spinner, options })
57
- }
58
- } catch (e) {
59
- process.exit(1)
60
- }
61
- })
62
- .addOption(new Option('-c, --config <path>', 'Path to the Kubb config'))
63
- .addOption(new Option('-i, --input <path>', 'Path of the input file(overrides the one in `kubb.config.js`)'))
64
- .addOption(new Option('-l, --logLevel <type>', 'Type of the logging(overrides the one in `kubb.config.js`)').choices(['error', 'info', 'silent']))
65
- .addOption(new Option('--init', 'Init Kubb'))
66
- .addOption(new Option('-d, --debug', 'Debug mode').default(false))
67
- .addOption(new Option('-w, --watch', 'Watch mode based on the input file'))
68
-
69
- program.name(moduleName).description('Generate').version(version, '-v').parse()