@kubb/cli 3.0.0-alpha.3 → 3.0.0-alpha.4

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.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
2
 
3
3
 
4
- var _chunkNKSXZ2SMcjs = require('./chunk-NKSXZ2SM.cjs');
4
+ var _chunk7CMTKETPcjs = require('./chunk-7CMTKETP.cjs');
5
5
 
6
6
  // src/index.ts
7
- _chunkNKSXZ2SMcjs.init_cjs_shims.call(void 0, );
7
+ _chunk7CMTKETPcjs.init_cjs_shims.call(void 0, );
8
8
  var _citty = require('citty');
9
9
  var _latestversion = require('latest-version'); var _latestversion2 = _interopRequireDefault(_latestversion);
10
10
  var _semver = require('semver');
11
11
  var _consola = require('consola'); var _consola2 = _interopRequireDefault(_consola);
12
12
 
13
13
  // package.json
14
- var version = "3.0.0-alpha.3";
14
+ var version = "3.0.0-alpha.4";
15
15
 
16
16
  // src/index.ts
17
17
  var name = "kubb";
@@ -39,13 +39,13 @@ Run \`npm install -g @kubb/cli\` to update`,
39
39
  } catch (_e) {
40
40
  }
41
41
  if (rawArgs[0] !== "generate") {
42
- const generateCommand = await Promise.resolve().then(() => _interopRequireWildcard(require("./generate-SW6IGE4J.cjs"))).then((r) => r.default);
42
+ const generateCommand = await Promise.resolve().then(() => _interopRequireWildcard(require("./generate-ZGEX2WSJ.cjs"))).then((r) => r.default);
43
43
  await _citty.runCommand.call(void 0, generateCommand, { rawArgs });
44
44
  process.exit(0);
45
45
  }
46
46
  },
47
47
  subCommands: {
48
- generate: () => Promise.resolve().then(() => _interopRequireWildcard(require("./generate-SW6IGE4J.cjs"))).then((r) => r.default)
48
+ generate: () => Promise.resolve().then(() => _interopRequireWildcard(require("./generate-ZGEX2WSJ.cjs"))).then((r) => r.default)
49
49
  }
50
50
  });
51
51
  async function run(_argv) {
@@ -54,5 +54,5 @@ async function run(_argv) {
54
54
 
55
55
 
56
56
 
57
- exports.generate = _chunkNKSXZ2SMcjs.generate; exports.run = run;
57
+ exports.generate = _chunk7CMTKETPcjs.generate; exports.run = run;
58
58
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/cli/dist/index.cjs","../src/index.ts","../package.json"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,8CAAA,CAAA;AAAA,8BAAmD;AACnD,6GAA6B;AAC7B,gCAAmB;AAEnB,oFAAoB;ADOpB;AACA;AEVE,IAAA,QAAA,EAAW,eAAA;AFYb;AACA;ACRA,IAAM,KAAA,EAAO,MAAA;AAEb,IAAM,KAAA,EAAO,kCAAA;AAAc,EACzB,IAAA,EAAM;AAAA,IACJ,IAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA,EAAa;AAAA,EACf,CAAA;AAAA,EACA,MAAM,KAAA,CAAM,EAAE,QAAQ,CAAA,EAAG;AACvB,IAAA,IAAI;AACF,MAAA,MAAM,cAAA,EAAgB,MAAM,qCAAA,WAA4B,CAAA;AAExD,MAAA,GAAA,CAAI,wBAAA,OAAG,EAAS,aAAa,CAAA,EAAG;AAC9B,QAAA,iBAAA,CAAQ,GAAA,CAAI;AAAA,UACV,KAAA,EAAO,8BAAA;AAAA,UACP,OAAA,EAAS,CAAA,GAAA,EAAM,OAAO,CAAA,aAAA,EAAW,aAAa,CAAA;AAAA,0CAAA,CAAA;AAAA,UAE9C,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,CAAA;AAAA,YACT,WAAA,EAAa,QAAA;AAAA,YACb,WAAA,EAAa;AAAA,UACf;AAAA,QACF,CAAC,CAAA;AAAA,MACH;AAAA,IACF,EAAA,MAAA,CAAS,EAAA,EAAI;AAAA,IAAC;AAEd,IAAA,GAAA,CAAI,OAAA,CAAQ,CAAC,EAAA,IAAM,UAAA,EAAY;AAE7B,MAAA,MAAM,gBAAA,EAAkB,MAAM,4DAAA,CAAO,yBAAwB,GAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,OAAO,CAAA;AAEpF,MAAA,MAAM,+BAAA,eAAW,EAAiB,EAAE,QAAQ,CAAC,CAAA;AAE7C,MAAA,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF,CAAA;AAAA,EACA,WAAA,EAAa;AAAA,IACX,QAAA,EAAU,CAAA,EAAA,GAAM,4DAAA,CAAO,yBAAwB,GAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,OAAO;AAAA,EACxE;AACF,CAAC,CAAA;AAED,MAAA,SAAsB,GAAA,CAAI,KAAA,EAAiC;AACzD,EAAA,MAAM,4BAAA,IAAY,CAAA;AACpB;ADIA;AACE;AACA;AACF,iEAAC","file":"/home/runner/work/kubb/kubb/packages/cli/dist/index.cjs","sourcesContent":[null,"import { defineCommand, runCommand, runMain } from 'citty'\nimport getLatestVersion from 'latest-version'\nimport { lt } from 'semver'\n\nimport consola from 'consola'\nimport { version } from '../package.json'\n\nconst name = 'kubb'\n\nconst main = defineCommand({\n meta: {\n name,\n version,\n description: 'Kubb generation',\n },\n async setup({ rawArgs }) {\n try {\n const latestVersion = await getLatestVersion('@kubb/cli')\n\n if (lt(version, latestVersion)) {\n consola.box({\n title: 'Update available for `Kubb` ',\n message: `\\`v${version}\\` → \\`v${latestVersion}\\`\nRun \\`npm install -g @kubb/cli\\` to update`,\n style: {\n padding: 2,\n borderColor: 'yellow',\n borderStyle: 'rounded',\n },\n })\n }\n } catch (_e) {}\n\n if (rawArgs[0] !== 'generate') {\n // generate is not being used\n const generateCommand = await import('./commands/generate.ts').then((r) => r.default)\n\n await runCommand(generateCommand, { rawArgs })\n\n process.exit(0)\n }\n },\n subCommands: {\n generate: () => import('./commands/generate.ts').then((r) => r.default),\n },\n})\n\nexport async function run(_argv?: string[]): Promise<void> {\n await runMain(main)\n}\n\nexport { generate } from './generate.ts'\n","{\n \"name\": \"@kubb/cli\",\n \"version\": \"3.0.0-alpha.3\",\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-labs/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.cjs\",\n \"module\": \"dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"bin\": {\n \"kubb\": \"bin/kubb.cjs\",\n \"bkubb\": \"bin/bkubb.cjs\"\n },\n \"files\": [\n \"src\",\n \"dist\",\n \"bin\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"npx rimraf ./dist\",\n \"lint\": \"bun biome lint .\",\n \"lint:fix\": \"bun biome lint --apply-unsafe .\",\n \"release\": \"pnpm publish --no-git-check\",\n \"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n \"start\": \"tsup --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@kubb/fs\": \"workspace:*\",\n \"bundle-require\": \"^5.0.0\",\n \"chokidar\": \"^3.6.0\",\n \"citty\": \"^0.1.6\",\n \"consola\": \"^3.2.3\",\n \"cosmiconfig\": \"^9.0.0\",\n \"esbuild\": \"^0.23.1\",\n \"execa\": \"^9.3.1\",\n \"js-runtime\": \"^0.0.8\",\n \"latest-version\": \"^9.0.0\",\n \"ora\": \"^8.0.1\",\n \"semver\": \"^7.6.3\",\n \"string-argv\": \"^0.3.2\",\n \"tinyrainbow\": \"^1.2.0\"\n },\n \"devDependencies\": {\n \"@kubb/config-ts\": \"workspace:*\",\n \"@kubb/config-tsup\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@types/node\": \"^20.16.1\",\n \"@types/semver\": \"^7.5.8\",\n \"source-map-support\": \"^0.5.21\",\n \"tsup\": \"^8.2.4\",\n \"typescript\": \"^5.5.4\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"preferGlobal\": true,\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/kubb/kubb/packages/cli/dist/index.cjs","../src/index.ts","../package.json"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACA;ACLA,8CAAA,CAAA;AAAA,8BAAmD;AACnD,6GAA6B;AAC7B,gCAAmB;AAEnB,oFAAoB;ADOpB;AACA;AEVE,IAAA,QAAA,EAAW,eAAA;AFYb;AACA;ACRA,IAAM,KAAA,EAAO,MAAA;AAEb,IAAM,KAAA,EAAO,kCAAA;AAAc,EACzB,IAAA,EAAM;AAAA,IACJ,IAAA;AAAA,IACA,OAAA;AAAA,IACA,WAAA,EAAa;AAAA,EACf,CAAA;AAAA,EACA,MAAM,KAAA,CAAM,EAAE,QAAQ,CAAA,EAAG;AACvB,IAAA,IAAI;AACF,MAAA,MAAM,cAAA,EAAgB,MAAM,qCAAA,WAA4B,CAAA;AAExD,MAAA,GAAA,CAAI,wBAAA,OAAG,EAAS,aAAa,CAAA,EAAG;AAC9B,QAAA,iBAAA,CAAQ,GAAA,CAAI;AAAA,UACV,KAAA,EAAO,8BAAA;AAAA,UACP,OAAA,EAAS,CAAA,GAAA,EAAM,OAAO,CAAA,aAAA,EAAW,aAAa,CAAA;AAAA,0CAAA,CAAA;AAAA,UAE9C,KAAA,EAAO;AAAA,YACL,OAAA,EAAS,CAAA;AAAA,YACT,WAAA,EAAa,QAAA;AAAA,YACb,WAAA,EAAa;AAAA,UACf;AAAA,QACF,CAAC,CAAA;AAAA,MACH;AAAA,IACF,EAAA,MAAA,CAAS,EAAA,EAAI;AAAA,IAAC;AAEd,IAAA,GAAA,CAAI,OAAA,CAAQ,CAAC,EAAA,IAAM,UAAA,EAAY;AAE7B,MAAA,MAAM,gBAAA,EAAkB,MAAM,4DAAA,CAAO,yBAAwB,GAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,OAAO,CAAA;AAEpF,MAAA,MAAM,+BAAA,eAAW,EAAiB,EAAE,QAAQ,CAAC,CAAA;AAE7C,MAAA,OAAA,CAAQ,IAAA,CAAK,CAAC,CAAA;AAAA,IAChB;AAAA,EACF,CAAA;AAAA,EACA,WAAA,EAAa;AAAA,IACX,QAAA,EAAU,CAAA,EAAA,GAAM,4DAAA,CAAO,yBAAwB,GAAA,CAAE,IAAA,CAAK,CAAC,CAAA,EAAA,GAAM,CAAA,CAAE,OAAO;AAAA,EACxE;AACF,CAAC,CAAA;AAED,MAAA,SAAsB,GAAA,CAAI,KAAA,EAAiC;AACzD,EAAA,MAAM,4BAAA,IAAY,CAAA;AACpB;ADIA;AACE;AACA;AACF,iEAAC","file":"/home/runner/work/kubb/kubb/packages/cli/dist/index.cjs","sourcesContent":[null,"import { defineCommand, runCommand, runMain } from 'citty'\nimport getLatestVersion from 'latest-version'\nimport { lt } from 'semver'\n\nimport consola from 'consola'\nimport { version } from '../package.json'\n\nconst name = 'kubb'\n\nconst main = defineCommand({\n meta: {\n name,\n version,\n description: 'Kubb generation',\n },\n async setup({ rawArgs }) {\n try {\n const latestVersion = await getLatestVersion('@kubb/cli')\n\n if (lt(version, latestVersion)) {\n consola.box({\n title: 'Update available for `Kubb` ',\n message: `\\`v${version}\\` → \\`v${latestVersion}\\`\nRun \\`npm install -g @kubb/cli\\` to update`,\n style: {\n padding: 2,\n borderColor: 'yellow',\n borderStyle: 'rounded',\n },\n })\n }\n } catch (_e) {}\n\n if (rawArgs[0] !== 'generate') {\n // generate is not being used\n const generateCommand = await import('./commands/generate.ts').then((r) => r.default)\n\n await runCommand(generateCommand, { rawArgs })\n\n process.exit(0)\n }\n },\n subCommands: {\n generate: () => import('./commands/generate.ts').then((r) => r.default),\n },\n})\n\nexport async function run(_argv?: string[]): Promise<void> {\n await runMain(main)\n}\n\nexport { generate } from './generate.ts'\n","{\n \"name\": \"@kubb/cli\",\n \"version\": \"3.0.0-alpha.4\",\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-labs/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.cjs\",\n \"module\": \"dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"bin\": {\n \"kubb\": \"bin/kubb.cjs\",\n \"bkubb\": \"bin/bkubb.cjs\"\n },\n \"files\": [\n \"src\",\n \"dist\",\n \"bin\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"npx rimraf ./dist\",\n \"lint\": \"bun biome lint .\",\n \"lint:fix\": \"bun biome lint --apply-unsafe .\",\n \"release\": \"pnpm publish --no-git-check\",\n \"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n \"start\": \"tsup --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@kubb/fs\": \"workspace:*\",\n \"bundle-require\": \"^5.0.0\",\n \"chokidar\": \"^3.6.0\",\n \"citty\": \"^0.1.6\",\n \"cli-progress\": \"^3.12.0\",\n \"consola\": \"^3.2.3\",\n \"cosmiconfig\": \"^9.0.0\",\n \"esbuild\": \"^0.23.1\",\n \"execa\": \"^9.3.1\",\n \"js-runtime\": \"^0.0.8\",\n \"latest-version\": \"^9.0.0\",\n \"semver\": \"^7.6.3\",\n \"string-argv\": \"^0.3.2\",\n \"tinyrainbow\": \"^1.2.0\"\n },\n \"devDependencies\": {\n \"@kubb/config-ts\": \"workspace:*\",\n \"@kubb/config-tsup\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@types/cli-progress\": \"^3.11.6\",\n \"@types/node\": \"^20.16.1\",\n \"@types/semver\": \"^7.5.8\",\n \"source-map-support\": \"^0.5.21\",\n \"tsup\": \"^8.2.4\",\n \"typescript\": \"^5.5.4\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"preferGlobal\": true,\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n"]}
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  generate
3
- } from "./chunk-VGYRBGKV.js";
3
+ } from "./chunk-Y35VLSP2.js";
4
4
 
5
5
  // src/index.ts
6
6
  import { defineCommand, runCommand, runMain } from "citty";
@@ -9,7 +9,7 @@ import { lt } from "semver";
9
9
  import consola from "consola";
10
10
 
11
11
  // package.json
12
- var version = "3.0.0-alpha.3";
12
+ var version = "3.0.0-alpha.4";
13
13
 
14
14
  // src/index.ts
15
15
  var name = "kubb";
@@ -37,13 +37,13 @@ Run \`npm install -g @kubb/cli\` to update`,
37
37
  } catch (_e) {
38
38
  }
39
39
  if (rawArgs[0] !== "generate") {
40
- const generateCommand = await import("./generate-IC27XOTA.js").then((r) => r.default);
40
+ const generateCommand = await import("./generate-FHYQHKKR.js").then((r) => r.default);
41
41
  await runCommand(generateCommand, { rawArgs });
42
42
  process.exit(0);
43
43
  }
44
44
  },
45
45
  subCommands: {
46
- generate: () => import("./generate-IC27XOTA.js").then((r) => r.default)
46
+ generate: () => import("./generate-FHYQHKKR.js").then((r) => r.default)
47
47
  }
48
48
  });
49
49
  async function run(_argv) {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../package.json"],"sourcesContent":["import { defineCommand, runCommand, runMain } from 'citty'\nimport getLatestVersion from 'latest-version'\nimport { lt } from 'semver'\n\nimport consola from 'consola'\nimport { version } from '../package.json'\n\nconst name = 'kubb'\n\nconst main = defineCommand({\n meta: {\n name,\n version,\n description: 'Kubb generation',\n },\n async setup({ rawArgs }) {\n try {\n const latestVersion = await getLatestVersion('@kubb/cli')\n\n if (lt(version, latestVersion)) {\n consola.box({\n title: 'Update available for `Kubb` ',\n message: `\\`v${version}\\` → \\`v${latestVersion}\\`\nRun \\`npm install -g @kubb/cli\\` to update`,\n style: {\n padding: 2,\n borderColor: 'yellow',\n borderStyle: 'rounded',\n },\n })\n }\n } catch (_e) {}\n\n if (rawArgs[0] !== 'generate') {\n // generate is not being used\n const generateCommand = await import('./commands/generate.ts').then((r) => r.default)\n\n await runCommand(generateCommand, { rawArgs })\n\n process.exit(0)\n }\n },\n subCommands: {\n generate: () => import('./commands/generate.ts').then((r) => r.default),\n },\n})\n\nexport async function run(_argv?: string[]): Promise<void> {\n await runMain(main)\n}\n\nexport { generate } from './generate.ts'\n","{\n \"name\": \"@kubb/cli\",\n \"version\": \"3.0.0-alpha.3\",\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-labs/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.cjs\",\n \"module\": \"dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"bin\": {\n \"kubb\": \"bin/kubb.cjs\",\n \"bkubb\": \"bin/bkubb.cjs\"\n },\n \"files\": [\n \"src\",\n \"dist\",\n \"bin\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"npx rimraf ./dist\",\n \"lint\": \"bun biome lint .\",\n \"lint:fix\": \"bun biome lint --apply-unsafe .\",\n \"release\": \"pnpm publish --no-git-check\",\n \"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n \"start\": \"tsup --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@kubb/fs\": \"workspace:*\",\n \"bundle-require\": \"^5.0.0\",\n \"chokidar\": \"^3.6.0\",\n \"citty\": \"^0.1.6\",\n \"consola\": \"^3.2.3\",\n \"cosmiconfig\": \"^9.0.0\",\n \"esbuild\": \"^0.23.1\",\n \"execa\": \"^9.3.1\",\n \"js-runtime\": \"^0.0.8\",\n \"latest-version\": \"^9.0.0\",\n \"ora\": \"^8.0.1\",\n \"semver\": \"^7.6.3\",\n \"string-argv\": \"^0.3.2\",\n \"tinyrainbow\": \"^1.2.0\"\n },\n \"devDependencies\": {\n \"@kubb/config-ts\": \"workspace:*\",\n \"@kubb/config-tsup\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@types/node\": \"^20.16.1\",\n \"@types/semver\": \"^7.5.8\",\n \"source-map-support\": \"^0.5.21\",\n \"tsup\": \"^8.2.4\",\n \"typescript\": \"^5.5.4\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"preferGlobal\": true,\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,eAAe,YAAY,eAAe;AACnD,OAAO,sBAAsB;AAC7B,SAAS,UAAU;AAEnB,OAAO,aAAa;;;ACFlB,cAAW;;;ADKb,IAAM,OAAO;AAEb,IAAM,OAAO,cAAc;AAAA,EACzB,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,aAAa;AAAA,EACf;AAAA,EACA,MAAM,MAAM,EAAE,QAAQ,GAAG;AACvB,QAAI;AACF,YAAM,gBAAgB,MAAM,iBAAiB,WAAW;AAExD,UAAI,GAAG,SAAS,aAAa,GAAG;AAC9B,gBAAQ,IAAI;AAAA,UACV,OAAO;AAAA,UACP,SAAS,MAAM,OAAO,gBAAW,aAAa;AAAA;AAAA,UAE9C,OAAO;AAAA,YACL,SAAS;AAAA,YACT,aAAa;AAAA,YACb,aAAa;AAAA,UACf;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,SAAS,IAAI;AAAA,IAAC;AAEd,QAAI,QAAQ,CAAC,MAAM,YAAY;AAE7B,YAAM,kBAAkB,MAAM,OAAO,wBAAwB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAEpF,YAAM,WAAW,iBAAiB,EAAE,QAAQ,CAAC;AAE7C,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,UAAU,MAAM,OAAO,wBAAwB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,EACxE;AACF,CAAC;AAED,eAAsB,IAAI,OAAiC;AACzD,QAAM,QAAQ,IAAI;AACpB;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../package.json"],"sourcesContent":["import { defineCommand, runCommand, runMain } from 'citty'\nimport getLatestVersion from 'latest-version'\nimport { lt } from 'semver'\n\nimport consola from 'consola'\nimport { version } from '../package.json'\n\nconst name = 'kubb'\n\nconst main = defineCommand({\n meta: {\n name,\n version,\n description: 'Kubb generation',\n },\n async setup({ rawArgs }) {\n try {\n const latestVersion = await getLatestVersion('@kubb/cli')\n\n if (lt(version, latestVersion)) {\n consola.box({\n title: 'Update available for `Kubb` ',\n message: `\\`v${version}\\` → \\`v${latestVersion}\\`\nRun \\`npm install -g @kubb/cli\\` to update`,\n style: {\n padding: 2,\n borderColor: 'yellow',\n borderStyle: 'rounded',\n },\n })\n }\n } catch (_e) {}\n\n if (rawArgs[0] !== 'generate') {\n // generate is not being used\n const generateCommand = await import('./commands/generate.ts').then((r) => r.default)\n\n await runCommand(generateCommand, { rawArgs })\n\n process.exit(0)\n }\n },\n subCommands: {\n generate: () => import('./commands/generate.ts').then((r) => r.default),\n },\n})\n\nexport async function run(_argv?: string[]): Promise<void> {\n await runMain(main)\n}\n\nexport { generate } from './generate.ts'\n","{\n \"name\": \"@kubb/cli\",\n \"version\": \"3.0.0-alpha.4\",\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-labs/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.cjs\",\n \"module\": \"dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\",\n \"default\": \"./dist/index.cjs\"\n }\n },\n \"bin\": {\n \"kubb\": \"bin/kubb.cjs\",\n \"bkubb\": \"bin/bkubb.cjs\"\n },\n \"files\": [\n \"src\",\n \"dist\",\n \"bin\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"clean\": \"npx rimraf ./dist\",\n \"lint\": \"bun biome lint .\",\n \"lint:fix\": \"bun biome lint --apply-unsafe .\",\n \"release\": \"pnpm publish --no-git-check\",\n \"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n \"start\": \"tsup --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@kubb/fs\": \"workspace:*\",\n \"bundle-require\": \"^5.0.0\",\n \"chokidar\": \"^3.6.0\",\n \"citty\": \"^0.1.6\",\n \"cli-progress\": \"^3.12.0\",\n \"consola\": \"^3.2.3\",\n \"cosmiconfig\": \"^9.0.0\",\n \"esbuild\": \"^0.23.1\",\n \"execa\": \"^9.3.1\",\n \"js-runtime\": \"^0.0.8\",\n \"latest-version\": \"^9.0.0\",\n \"semver\": \"^7.6.3\",\n \"string-argv\": \"^0.3.2\",\n \"tinyrainbow\": \"^1.2.0\"\n },\n \"devDependencies\": {\n \"@kubb/config-ts\": \"workspace:*\",\n \"@kubb/config-tsup\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@types/cli-progress\": \"^3.11.6\",\n \"@types/node\": \"^20.16.1\",\n \"@types/semver\": \"^7.5.8\",\n \"source-map-support\": \"^0.5.21\",\n \"tsup\": \"^8.2.4\",\n \"typescript\": \"^5.5.4\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"preferGlobal\": true,\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n"],"mappings":";;;;;AAAA,SAAS,eAAe,YAAY,eAAe;AACnD,OAAO,sBAAsB;AAC7B,SAAS,UAAU;AAEnB,OAAO,aAAa;;;ACFlB,cAAW;;;ADKb,IAAM,OAAO;AAEb,IAAM,OAAO,cAAc;AAAA,EACzB,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA,aAAa;AAAA,EACf;AAAA,EACA,MAAM,MAAM,EAAE,QAAQ,GAAG;AACvB,QAAI;AACF,YAAM,gBAAgB,MAAM,iBAAiB,WAAW;AAExD,UAAI,GAAG,SAAS,aAAa,GAAG;AAC9B,gBAAQ,IAAI;AAAA,UACV,OAAO;AAAA,UACP,SAAS,MAAM,OAAO,gBAAW,aAAa;AAAA;AAAA,UAE9C,OAAO;AAAA,YACL,SAAS;AAAA,YACT,aAAa;AAAA,YACb,aAAa;AAAA,UACf;AAAA,QACF,CAAC;AAAA,MACH;AAAA,IACF,SAAS,IAAI;AAAA,IAAC;AAEd,QAAI,QAAQ,CAAC,MAAM,YAAY;AAE7B,YAAM,kBAAkB,MAAM,OAAO,wBAAwB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAEpF,YAAM,WAAW,iBAAiB,EAAE,QAAQ,CAAC;AAE7C,cAAQ,KAAK,CAAC;AAAA,IAChB;AAAA,EACF;AAAA,EACA,aAAa;AAAA,IACX,UAAU,MAAM,OAAO,wBAAwB,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO;AAAA,EACxE;AACF,CAAC;AAED,eAAsB,IAAI,OAAiC;AACzD,QAAM,QAAQ,IAAI;AACpB;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/cli",
3
- "version": "3.0.0-alpha.3",
3
+ "version": "3.0.0-alpha.4",
4
4
  "description": "Generator cli",
5
5
  "keywords": [
6
6
  "typescript",
@@ -43,28 +43,29 @@
43
43
  "bundle-require": "^5.0.0",
44
44
  "chokidar": "^3.6.0",
45
45
  "citty": "^0.1.6",
46
+ "cli-progress": "^3.12.0",
46
47
  "consola": "^3.2.3",
47
48
  "cosmiconfig": "^9.0.0",
48
49
  "esbuild": "^0.23.1",
49
50
  "execa": "^9.3.1",
50
51
  "js-runtime": "^0.0.8",
51
52
  "latest-version": "^9.0.0",
52
- "ora": "^8.0.1",
53
53
  "semver": "^7.6.3",
54
54
  "string-argv": "^0.3.2",
55
55
  "tinyrainbow": "^1.2.0",
56
- "@kubb/core": "3.0.0-alpha.3",
57
- "@kubb/fs": "3.0.0-alpha.3"
56
+ "@kubb/core": "3.0.0-alpha.4",
57
+ "@kubb/fs": "3.0.0-alpha.4"
58
58
  },
59
59
  "devDependencies": {
60
+ "@types/cli-progress": "^3.11.6",
60
61
  "@types/node": "^20.16.1",
61
62
  "@types/semver": "^7.5.8",
62
63
  "source-map-support": "^0.5.21",
63
64
  "tsup": "^8.2.4",
64
65
  "typescript": "^5.5.4",
65
- "@kubb/config-ts": "3.0.0-alpha.3",
66
- "@kubb/config-tsup": "3.0.0-alpha.3",
67
- "@kubb/plugin-oas": "3.0.0-alpha.3"
66
+ "@kubb/config-ts": "3.0.0-alpha.4",
67
+ "@kubb/config-tsup": "3.0.0-alpha.4",
68
+ "@kubb/plugin-oas": "3.0.0-alpha.4"
68
69
  },
69
70
  "engines": {
70
71
  "node": ">=20"
@@ -1,17 +1,16 @@
1
- import { LogLevel } from '@kubb/core/logger'
2
1
  import { defineCommand, showUsage } from 'citty'
3
2
  import type { ArgsDef, ParsedArgs } from 'citty'
4
3
  import { execa } from 'execa'
5
4
  import c from 'tinyrainbow'
6
5
 
7
- import path from 'node:path'
8
6
  import { getConfig } from '../utils/getConfig.ts'
9
7
  import { getCosmiConfig } from '../utils/getCosmiConfig.ts'
10
- import { spinner } from '../utils/spinner.ts'
11
8
  import { startWatcher } from '../utils/watcher.ts'
12
9
 
13
10
  import { PromiseManager, isInputPath } from '@kubb/core'
14
11
  import { generate } from '../generate.ts'
12
+ import path from 'node:path'
13
+ import { createLogger, LogMapper } from '@kubb/core/logger'
15
14
 
16
15
  const args = {
17
16
  config: {
@@ -23,8 +22,8 @@ const args = {
23
22
  type: 'string',
24
23
  description: 'Info, silent or debug',
25
24
  alias: 'l',
26
- default: LogLevel.info,
27
- valueHint: `${LogLevel.silent}|${LogLevel.info}|${LogLevel.debug}`,
25
+ default: 'info',
26
+ valueHint: 'silent|info|debug',
28
27
  },
29
28
  watch: {
30
29
  type: 'boolean',
@@ -60,9 +59,6 @@ const command = defineCommand({
60
59
  description: "[input] Generate files based on a 'kubb.config.ts' file",
61
60
  },
62
61
  args,
63
- setup() {
64
- spinner.start('🔍 Loading config')
65
- },
66
62
  async run({ args }) {
67
63
  const input = args._[0]
68
64
 
@@ -72,7 +68,7 @@ const command = defineCommand({
72
68
  }
73
69
 
74
70
  if (args.debug) {
75
- args.logLevel = LogLevel.debug
71
+ args.logLevel = 'debug'
76
72
  }
77
73
 
78
74
  if (args.bun) {
@@ -82,8 +78,15 @@ const command = defineCommand({
82
78
  return
83
79
  }
84
80
 
81
+ const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3
82
+ const logger = createLogger({
83
+ logLevel,
84
+ })
85
+
86
+ logger.emit('start', '🔍 Loading config')
87
+
85
88
  const result = await getCosmiConfig('kubb', args.config)
86
- spinner.succeed(`🔍 Config loaded(${c.dim(path.relative(process.cwd(), result.filepath))})`)
89
+ logger.emit('success', `🔍 Config loaded(${c.dim(path.relative(process.cwd(), result.filepath))})`)
87
90
 
88
91
  const config = await getConfig(result, args)
89
92
 
@@ -95,8 +98,7 @@ const command = defineCommand({
95
98
  if (isInputPath(config)) {
96
99
  return startWatcher([input || config.input.path], async (paths) => {
97
100
  await generate({ config, args })
98
- spinner.spinner = 'simpleDotsScrolling'
99
- spinner.start(c.yellow(c.bold(`Watching for changes in ${paths.join(' and ')}`)))
101
+ logger.emit('start', c.yellow(c.bold(`Watching for changes in ${paths.join(' and ')}`)))
100
102
  })
101
103
  }
102
104
  }
package/src/generate.ts CHANGED
@@ -1,16 +1,16 @@
1
- import { LogLevel, LogMapper, createLogger, randomCliColour } from '@kubb/core/logger'
1
+ import { createLogger } from '@kubb/core/logger'
2
2
 
3
3
  import c from 'tinyrainbow'
4
4
 
5
- import { spinner } from './utils/spinner.ts'
6
-
7
- import { type Config, Warning, safeBuild } from '@kubb/core'
8
- import { createConsola } from 'consola'
5
+ import { type Config, safeBuild } from '@kubb/core'
9
6
  import type { Args } from './commands/generate.ts'
10
7
  import { executeHooks } from './utils/executeHooks.ts'
11
8
  import { getErrorCauses } from './utils/getErrorCauses.ts'
12
9
  import { getSummary } from './utils/getSummary.ts'
13
10
  import { writeLog } from './utils/writeLog.ts'
11
+ import { LogMapper } from '@kubb/core/logger'
12
+
13
+ import { MultiBar, Presets } from 'cli-progress'
14
14
 
15
15
  type GenerateProps = {
16
16
  input?: string
@@ -18,49 +18,47 @@ type GenerateProps = {
18
18
  args: Args
19
19
  }
20
20
 
21
+ export function createMultiProgressBar() {
22
+ return new MultiBar(
23
+ {
24
+ format: 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}',
25
+ barsize: 40,
26
+ fps: 5,
27
+ stream: process.stderr,
28
+ clearOnComplete: true,
29
+ },
30
+ Presets.shades_grey,
31
+ )
32
+ }
33
+
21
34
  export async function generate({ input, config, args }: GenerateProps): Promise<void> {
22
- const logLevel = (args.logLevel as LogLevel) || LogLevel.silent
35
+ const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3
23
36
  const logger = createLogger({
24
37
  logLevel,
25
38
  name: config.name,
26
- spinner,
27
- consola: createConsola({
28
- level: LogMapper[logLevel] || 3,
29
- }),
30
39
  })
31
40
 
41
+ // const progress = createMultiProgressBar()
42
+ // let progressFiles: any
43
+ //
44
+ // logger.on('progress', (count, size) => {
45
+ // if (count === 0) {
46
+ // progressFiles = progress.create(size, 0)
47
+ // }
48
+ // progressFiles.update(count)
49
+ // if (count === size) {
50
+ // progressFiles.stop()
51
+ // }
52
+ // })
53
+
32
54
  logger.on('debug', async (messages: string[]) => {
33
- if (logLevel === LogLevel.debug) {
34
- await writeLog(messages.join('\n'))
35
- }
55
+ await writeLog(messages.join('\n'))
36
56
  })
37
57
 
38
- logger.consola?.wrapConsole()
39
-
40
- if (logger.name) {
41
- spinner.prefixText = randomCliColour(logger.name)
42
- }
43
-
44
- const hrstart = process.hrtime()
45
-
46
- if (args.logLevel === LogLevel.debug) {
47
- const { performance, PerformanceObserver } = await import('node:perf_hooks')
48
-
49
- const performanceOpserver = new PerformanceObserver((items) => {
50
- const message = `${items.getEntries()[0]?.duration.toFixed(0)}ms`
51
-
52
- spinner.suffixText = c.yellow(message)
53
-
54
- performance.clearMarks()
55
- })
56
-
57
- performanceOpserver.observe({ type: 'measure' })
58
- }
59
-
60
58
  const { root = process.cwd(), ...userConfig } = config
61
59
  const inputPath = input ?? ('path' in userConfig.input ? userConfig.input.path : undefined)
62
60
 
63
- spinner.start(`🚀 Building ${logLevel !== 'silent' ? c.dim(inputPath) : ''}`)
61
+ logger.emit('start', `🚀 Building ${logLevel !== LogMapper.silent ? c.dim(inputPath) : ''}`)
64
62
 
65
63
  const definedConfig: Config = {
66
64
  root,
@@ -76,6 +74,7 @@ export async function generate({ input, config, args }: GenerateProps): Promise<
76
74
  ...userConfig.output,
77
75
  },
78
76
  }
77
+ const hrStart = process.hrtime()
79
78
  const { pluginManager, error } = await safeBuild({
80
79
  config: definedConfig,
81
80
  logger,
@@ -85,25 +84,27 @@ export async function generate({ input, config, args }: GenerateProps): Promise<
85
84
  pluginManager,
86
85
  config: definedConfig,
87
86
  status: error ? 'failed' : 'success',
88
- hrstart,
87
+ hrStart,
89
88
  logger,
90
89
  })
91
90
 
92
- if (error) {
93
- spinner.suffixText = ''
94
- spinner.fail(`🚀 Build failed ${logLevel !== 'silent' ? c.dim(inputPath) : ''}`)
95
-
96
- console.log(summary.join(''))
97
-
98
- if (error instanceof Warning) {
99
- spinner.warn(c.yellow(error.message))
100
- process.exit(0)
101
- }
91
+ if (error && logger.consola) {
92
+ logger.consola.error(`🚀 Build failed ${logLevel !== LogMapper.silent ? c.dim(inputPath) : ''}`)
93
+
94
+ logger.consola.box({
95
+ title: `${config.name || ''}`,
96
+ message: summary.join(''),
97
+ style: {
98
+ padding: 2,
99
+ borderColor: 'red',
100
+ borderStyle: 'rounded',
101
+ },
102
+ })
102
103
 
103
104
  const errors = getErrorCauses([error])
104
- if (logger.consola && errors.length && logLevel === LogLevel.debug) {
105
+ if (logger.consola && errors.length && logLevel === LogMapper.debug) {
105
106
  errors.forEach((err) => {
106
- logger.consola!.error(err)
107
+ logger.consola?.error(err)
107
108
  })
108
109
  }
109
110
 
@@ -112,10 +113,19 @@ export async function generate({ input, config, args }: GenerateProps): Promise<
112
113
  process.exit(0)
113
114
  }
114
115
 
115
- await executeHooks({ hooks: config.hooks, logLevel })
116
+ if (config.hooks) {
117
+ await executeHooks({ hooks: config.hooks, logger })
118
+ }
116
119
 
117
- spinner.suffixText = ''
118
- spinner.succeed(`🚀 Build completed ${logLevel !== 'silent' ? c.dim(inputPath) : ''}`)
120
+ logger.consola?.success(`🚀 Build completed ${logLevel !== LogMapper.silent ? c.dim(inputPath) : ''}`)
119
121
 
120
- console.log(summary.join(''))
122
+ logger.consola?.box({
123
+ title: `${config.name || ''}`,
124
+ message: summary.join(''),
125
+ style: {
126
+ padding: 2,
127
+ borderColor: 'green',
128
+ borderStyle: 'rounded',
129
+ },
130
+ })
121
131
  }
@@ -0,0 +1,43 @@
1
+ import { Writable } from 'node:stream'
2
+
3
+ import c from 'tinyrainbow'
4
+
5
+ import type { WritableOptions } from 'node:stream'
6
+ import type { ConsolaInstance } from 'consola'
7
+
8
+ export class BasicWritables extends Writable {
9
+ #frame = 'Loading ...'
10
+ set frame(frame: string) {
11
+ this.#frame = frame
12
+ }
13
+ get frame() {
14
+ return this.#frame
15
+ }
16
+ _write(chunk: any, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void {
17
+ if (chunk?.toString() !== this.frame && chunk?.toString()) {
18
+ this.frame = chunk?.toString()
19
+ }
20
+
21
+ callback()
22
+ }
23
+ }
24
+
25
+ export class ConsolaWritable extends Writable {
26
+ consola: ConsolaInstance
27
+ command: string
28
+ constructor(consola: ConsolaInstance, command: string, opts?: WritableOptions) {
29
+ super(opts)
30
+
31
+ this.command = command
32
+ this.consola = consola
33
+ }
34
+ _write(chunk: any, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void {
35
+ if (this.command) {
36
+ this.consola.log(`${c.bold(c.blue(this.command))}: ${chunk?.toString()}`)
37
+ } else {
38
+ this.consola.log(`${c.bold(c.blue(this.command))}: ${chunk?.toString()}`)
39
+ }
40
+
41
+ callback()
42
+ }
43
+ }
@@ -1,33 +1,24 @@
1
- import { LogLevel } from '@kubb/core/logger'
1
+ import type { Logger } from '@kubb/core/logger'
2
2
  import { execa } from 'execa'
3
3
  import { parseArgsStringToArgv } from 'string-argv'
4
4
  import c from 'tinyrainbow'
5
5
 
6
- import { OraWritable } from './OraWritable.ts'
7
- import { spinner } from './spinner.ts'
6
+ import { ConsolaWritable } from './Writables.ts'
8
7
 
9
- import type { Writable } from 'node:stream'
10
8
  import type { Config } from '@kubb/core'
9
+ import { LogMapper } from '@kubb/core/logger'
11
10
 
12
11
  type ExecutingHooksProps = {
13
- hooks: Config['hooks']
14
- logLevel: LogLevel
12
+ hooks: NonNullable<Config['hooks']>
13
+ logger: Logger
15
14
  }
16
15
 
17
- export async function executeHooks({ hooks, logLevel }: ExecutingHooksProps): Promise<void> {
18
- if (!hooks?.done) {
19
- return
20
- }
16
+ export async function executeHooks({ hooks, logger }: ExecutingHooksProps): Promise<void> {
17
+ const commands = Array.isArray(hooks.done) ? hooks.done : [hooks.done].filter(Boolean)
21
18
 
22
- const commands = Array.isArray(hooks.done) ? hooks.done : [hooks.done]
23
-
24
- if (logLevel === LogLevel.silent) {
25
- spinner.start('Executing hooks')
26
- }
27
-
28
- const executers = commands
19
+ const executors = commands
29
20
  .map(async (command) => {
30
- const oraWritable = new OraWritable(spinner, command)
21
+ const consolaWritable = new ConsolaWritable(logger.consola!, command)
31
22
  const abortController = new AbortController()
32
23
  const [cmd, ..._args] = [...parseArgsStringToArgv(command)]
33
24
 
@@ -35,31 +26,26 @@ export async function executeHooks({ hooks, logLevel }: ExecutingHooksProps): Pr
35
26
  return null
36
27
  }
37
28
 
38
- spinner.start(`Executing hook ${logLevel !== 'silent' ? c.dim(command) : ''}`)
29
+ logger.emit('start', `Executing hook ${logger.logLevel !== LogMapper.silent ? c.dim(command) : ''}`)
39
30
 
40
31
  const subProcess = await execa(cmd, _args, {
41
32
  detached: true,
42
33
  cancelSignal: abortController.signal,
43
- stdout: ['pipe', oraWritable],
34
+ stdout: logger.logLevel === LogMapper.silent ? undefined : ['pipe', consolaWritable],
44
35
  })
45
- spinner.suffixText = ''
46
36
 
47
- if (logLevel === LogLevel.silent) {
48
- spinner.succeed(`Executing hook ${logLevel !== 'silent' ? c.dim(command) : ''}`)
37
+ logger.emit('success', `Executing hook ${logger.logLevel !== LogMapper.silent ? c.dim(command) : ''}`)
49
38
 
50
- if (subProcess) {
51
- console.log(subProcess.stdout)
52
- }
39
+ if (subProcess) {
40
+ logger.emit('info', `Executing hooks\n ${subProcess.stdout}`)
53
41
  }
54
42
 
55
- oraWritable.destroy()
43
+ consolaWritable.destroy()
56
44
  return { subProcess, abort: abortController.abort.bind(abortController) }
57
45
  })
58
46
  .filter(Boolean)
59
47
 
60
- await Promise.all(executers)
48
+ await Promise.all(executors)
61
49
 
62
- if (logLevel === LogLevel.silent) {
63
- spinner.succeed('Executing hooks')
64
- }
50
+ logger.emit('success', 'Executing hooks')
65
51
  }
@@ -1,5 +1,3 @@
1
- import { PackageManager } from '@kubb/core'
2
-
3
1
  import type { UserConfig } from '@kubb/core'
4
2
 
5
3
  function isJSONPlugins(plugins: UserConfig['plugins']) {
@@ -12,14 +10,6 @@ function isObjectPlugins(plugins: UserConfig['plugins']): plugins is any {
12
10
  return plugins instanceof Object && !Array.isArray(plugins)
13
11
  }
14
12
 
15
- async function importPlugin(name: string, options: object): Promise<UserConfig['plugins']> {
16
- const packageManager = new PackageManager(process.cwd())
17
-
18
- const importedPlugin: any = process.env.NODE_ENV === 'test' ? await import(name) : await packageManager.import(name)
19
-
20
- return importedPlugin?.default ? importedPlugin.default(options) : importedPlugin(options)
21
- }
22
-
23
13
  export function getPlugins(plugins: UserConfig['plugins']): Promise<UserConfig['plugins']> {
24
14
  if (isObjectPlugins(plugins)) {
25
15
  throw new Error('Object plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')
@@ -12,15 +12,14 @@ import type { Logger } from '@kubb/core/logger'
12
12
  type SummaryProps = {
13
13
  pluginManager: PluginManager
14
14
  status: 'success' | 'failed'
15
- hrstart: [number, number]
15
+ hrStart: [number, number]
16
16
  config: Config
17
17
  logger: Logger
18
18
  }
19
19
 
20
- export function getSummary({ pluginManager, status, hrstart, config, logger }: SummaryProps): string[] {
21
- const { logLevel } = logger
20
+ export function getSummary({ pluginManager, status, hrStart, config, logger }: SummaryProps): string[] {
22
21
  const logs: string[] = []
23
- const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrstart))
22
+ const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrStart))
24
23
 
25
24
  const buildStartPlugins = pluginManager.executed
26
25
  .filter((item) => item.hookName === 'buildStart' && item.plugin.name !== 'core')
@@ -44,15 +43,13 @@ export function getSummary({ pluginManager, status, hrstart, config, logger }: S
44
43
  })
45
44
 
46
45
  const meta = {
47
- name: config.name,
48
46
  plugins:
49
47
  status === 'success'
50
48
  ? `${c.green(`${buildStartPlugins.length} successful`)}, ${pluginsCount} total`
51
49
  : `${c.red(`${failedPlugins?.length ?? 1} failed`)}, ${pluginsCount} total`,
52
50
  pluginsFailed: status === 'failed' ? failedPlugins?.map((name) => randomCliColour(name))?.join(', ') : undefined,
53
51
  filesCreated: files.length,
54
- time: c.yellow(`${elapsedSeconds}s`),
55
- endTime: c.yellow(Date()),
52
+ time: `${c.yellow(`${elapsedSeconds}s`)} - finished at ${c.yellow(new Date().toLocaleString('en-GB', { timeZone: 'UTC' }))}`,
56
53
  output: path.isAbsolute(config.root) ? path.resolve(config.root, config.output.path) : config.root,
57
54
  } as const
58
55
 
@@ -64,14 +61,11 @@ export function getSummary({ pluginManager, status, hrstart, config, logger }: S
64
61
 
65
62
  logs.push(
66
63
  [
67
- ['\n', true],
68
- [` ${c.bold('Name:')} ${meta.name}`, !!meta.name],
69
- [` ${c.bold('Plugins:')} ${meta.plugins}`, true],
70
- [` ${c.dim('Failed:')} ${meta.pluginsFailed || 'none'}`, !!meta.pluginsFailed],
64
+ [`${c.bold('Plugins:')} ${meta.plugins}`, true],
65
+ [`${c.dim('Failed:')} ${meta.pluginsFailed || 'none'}`, !!meta.pluginsFailed],
71
66
  [`${c.bold('Generated:')} ${meta.filesCreated} files`, true],
72
- [` ${c.bold('Time:')} ${meta.time}`, true],
73
- [` ${c.bold('Ended:')} ${meta.endTime}`, true],
74
- [` ${c.bold('Output:')} ${meta.output}`, true],
67
+ [`${c.bold('Time:')} ${meta.time}`, true],
68
+ [`${c.bold('Output:')} ${meta.output}`, true],
75
69
  ]
76
70
  .map((item) => {
77
71
  if (item.at(1)) {