@kubb/cli 5.0.0-alpha.52 → 5.0.0-alpha.53
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/{agent-CyXvl4j6.cjs → agent-BGS_7MP9.cjs} +2 -2
- package/dist/{agent-CyXvl4j6.cjs.map → agent-BGS_7MP9.cjs.map} +1 -1
- package/dist/{agent-D_DzTqSx.js → agent-Dw0KlUTC.js} +2 -2
- package/dist/{agent-D_DzTqSx.js.map → agent-Dw0KlUTC.js.map} +1 -1
- package/dist/{generate-BEWAGgDc.cjs → generate-BxzJaEso.cjs} +111 -80
- package/dist/generate-BxzJaEso.cjs.map +1 -0
- package/dist/{generate-C5ZuMK47.js → generate-Cn3YNt91.js} +111 -80
- package/dist/generate-Cn3YNt91.js.map +1 -0
- package/dist/{generate-Cr4SXhUE.js → generate-DQWnQVDD.js} +2 -2
- package/dist/{generate-Cr4SXhUE.js.map → generate-DQWnQVDD.js.map} +1 -1
- package/dist/{generate-XfgAmKJO.cjs → generate-NingTsUs.cjs} +2 -2
- package/dist/{generate-XfgAmKJO.cjs.map → generate-NingTsUs.cjs.map} +1 -1
- package/dist/index.cjs +6 -6
- package/dist/index.js +6 -6
- package/dist/{init-Cfgb3-m1.cjs → init-CHW9Rmto.cjs} +2 -2
- package/dist/{init-Cfgb3-m1.cjs.map → init-CHW9Rmto.cjs.map} +1 -1
- package/dist/{init-DntPjNaL.js → init-CTXpwqzv.js} +2 -2
- package/dist/{init-DntPjNaL.js.map → init-CTXpwqzv.js.map} +1 -1
- package/dist/{mcp-DfElIp1N.cjs → mcp-BXZYLBex.cjs} +2 -2
- package/dist/{mcp-DfElIp1N.cjs.map → mcp-BXZYLBex.cjs.map} +1 -1
- package/dist/{mcp-xQpXtS4T.js → mcp-DTdbpugQ.js} +2 -2
- package/dist/{mcp-xQpXtS4T.js.map → mcp-DTdbpugQ.js.map} +1 -1
- package/dist/{package-TAugqkSc.cjs → package-QtWhMWf6.cjs} +2 -2
- package/dist/package-QtWhMWf6.cjs.map +1 -0
- package/dist/package-dBI-ufat.js +6 -0
- package/dist/package-dBI-ufat.js.map +1 -0
- package/dist/{validate-Q5FM7up3.js → validate-BwS40gTp.js} +2 -2
- package/dist/{validate-Q5FM7up3.js.map → validate-BwS40gTp.js.map} +1 -1
- package/dist/{validate-C6cbSTUd.cjs → validate-D0QmlH_5.cjs} +2 -2
- package/dist/{validate-C6cbSTUd.cjs.map → validate-D0QmlH_5.cjs.map} +1 -1
- package/package.json +5 -5
- package/src/loggers/clackLogger.ts +16 -16
- package/src/loggers/fileSystemLogger.ts +9 -9
- package/src/loggers/githubActionsLogger.ts +12 -12
- package/src/loggers/plainLogger.ts +9 -9
- package/src/runners/generate.ts +28 -27
- package/src/utils/executeHooks.ts +6 -6
- package/src/utils/runHook.ts +2 -2
- package/dist/generate-BEWAGgDc.cjs.map +0 -1
- package/dist/generate-C5ZuMK47.js.map +0 -1
- package/dist/package-D5-gtCQz.js +0 -6
- package/dist/package-D5-gtCQz.js.map +0 -1
- package/dist/package-TAugqkSc.cjs.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
require("./chunk-ByKO4r7w.cjs");
|
|
2
2
|
const require_define = require("./define-Bdn8j5VM.cjs");
|
|
3
|
-
const require_package = require("./package-
|
|
3
|
+
const require_package = require("./package-QtWhMWf6.cjs");
|
|
4
4
|
const require_constants = require("./constants-B2q7VPbi.cjs");
|
|
5
5
|
//#region src/commands/agent/start.ts
|
|
6
6
|
const command$1 = require_define.defineCommand({
|
|
@@ -55,4 +55,4 @@ const command = require_define.defineCommand({
|
|
|
55
55
|
//#endregion
|
|
56
56
|
exports.command = command;
|
|
57
57
|
|
|
58
|
-
//# sourceMappingURL=agent-
|
|
58
|
+
//# sourceMappingURL=agent-BGS_7MP9.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-BGS_7MP9.cjs","names":["command","defineCommand","agentDefaults","defineCommand","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;AAIA,MAAaA,YAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,SAAS;EACP,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa,iCAAiCC,kBAAAA,cAAc,KAAK;GACjE,OAAO;GACR;EACD,MAAM;GACJ,MAAM;GACN,aAAa;GACb,SAASA,kBAAAA,cAAc;GACxB;EACD,eAAe;GACb,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACD,aAAa;GACX,MAAM;GACN,aAAa;GACb,SAAS;GACV;EACF;CACD,MAAM,IAAI,EAAE,UAAU;EACpB,MAAM,EAAE,kBAAkB,MAAA,QAAA,SAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;AAEhC,QAAM,cAAc;GAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;GAChD,MAAM,OAAO;GACb,YAAY,OAAO;GACnB,YAAY,OAAO;GACnB,UAAU,OAAO;GACjB,SAAA,gBAAA;GACD,CAAC;;CAEL,CAAC;;;AC3CF,MAAa,UAAUC,eAAAA,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CAACC,UAAa;CAC5B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "./chunk--u3MIqq1.js";
|
|
2
2
|
import { n as defineCommand } from "./define-Ctii4bel.js";
|
|
3
|
-
import { t as version } from "./package-
|
|
3
|
+
import { t as version } from "./package-dBI-ufat.js";
|
|
4
4
|
import { s as agentDefaults } from "./constants-T_2rsi7T.js";
|
|
5
5
|
//#endregion
|
|
6
6
|
//#region src/commands/agent.ts
|
|
@@ -53,4 +53,4 @@ const command = defineCommand({
|
|
|
53
53
|
//#endregion
|
|
54
54
|
export { command };
|
|
55
55
|
|
|
56
|
-
//# sourceMappingURL=agent-
|
|
56
|
+
//# sourceMappingURL=agent-Dw0KlUTC.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-
|
|
1
|
+
{"version":3,"file":"agent-Dw0KlUTC.js","names":["command","startCommand"],"sources":["../src/commands/agent/start.ts","../src/commands/agent.ts"],"sourcesContent":["import { defineCommand } from '@internals/utils'\nimport { version } from '../../../package.json'\nimport { agentDefaults } from '../../constants.ts'\n\nexport const command = defineCommand({\n name: 'start',\n description: 'Start the Agent server',\n options: {\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n port: {\n type: 'string',\n description: `Port for the server (default: ${agentDefaults.port})`,\n short: 'p',\n },\n host: {\n type: 'string',\n description: 'Host for the server',\n default: agentDefaults.host,\n },\n 'allow-write': {\n type: 'boolean',\n description: 'Allow writing generated files to the filesystem. When not set, no files are written and the config patch is not persisted.',\n default: false,\n },\n 'allow-all': {\n type: 'boolean',\n description: 'Grant all permissions (implies --allow-write).',\n default: false,\n },\n },\n async run({ values }) {\n const { runAgentStart } = await import('../../runners/agent.ts')\n\n await runAgentStart({\n port: values.port !== undefined ? values.port : undefined,\n host: values.host,\n configPath: values.config,\n allowWrite: values['allow-write'],\n allowAll: values['allow-all'],\n version,\n })\n },\n})\n","import { defineCommand } from '@internals/utils'\nimport { command as startCommand } from './agent/start.ts'\n\nexport const command = defineCommand({\n name: 'agent',\n description: 'Manage the Kubb Agent server',\n subCommands: [startCommand],\n})\n"],"mappings":";;;;;;ACGA,MAAa,UAAU,cAAc;CACnC,MAAM;CACN,aAAa;CACb,aAAa,CDFQ,cAAc;EACnC,MAAM;EACN,aAAa;EACb,SAAS;GACP,QAAQ;IACN,MAAM;IACN,aAAa;IACb,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa,iCAAiC,cAAc,KAAK;IACjE,OAAO;IACR;GACD,MAAM;IACJ,MAAM;IACN,aAAa;IACb,SAAS,cAAc;IACxB;GACD,eAAe;IACb,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACD,aAAa;IACX,MAAM;IACN,aAAa;IACb,SAAS;IACV;GACF;EACD,MAAM,IAAI,EAAE,UAAU;GACpB,MAAM,EAAE,kBAAkB,MAAM,OAAO;AAEvC,SAAM,cAAc;IAClB,MAAM,OAAO,SAAS,KAAA,IAAY,OAAO,OAAO,KAAA;IAChD,MAAM,OAAO;IACb,YAAY,OAAO;IACnB,YAAY,OAAO;IACnB,UAAU,OAAO;IACjB;IACD,CAAC;;EAEL,CAAC,CCxC2B;CAC5B,CAAC"}
|
|
@@ -2,7 +2,7 @@ const require_chunk = require("./chunk-ByKO4r7w.cjs");
|
|
|
2
2
|
const require_errors = require("./errors-CLCjoSg0.cjs");
|
|
3
3
|
const require_telemetry = require("./telemetry-B6ZbZOrb.cjs");
|
|
4
4
|
const require_shell = require("./shell-475fQKaX.cjs");
|
|
5
|
-
const require_package = require("./package-
|
|
5
|
+
const require_package = require("./package-QtWhMWf6.cjs");
|
|
6
6
|
const require_constants = require("./constants-B2q7VPbi.cjs");
|
|
7
7
|
let node_util = require("node:util");
|
|
8
8
|
let node_events = require("node:events");
|
|
@@ -544,7 +544,7 @@ async function runHook({ id, command, args, commandWithArgs, context, stream = f
|
|
|
544
544
|
success: false,
|
|
545
545
|
error: require_errors.toError(err)
|
|
546
546
|
});
|
|
547
|
-
await context.emit("kubb:error", require_errors.toError(err));
|
|
547
|
+
await context.emit("kubb:error", { error: require_errors.toError(err) });
|
|
548
548
|
return;
|
|
549
549
|
}
|
|
550
550
|
const stderr = err.output?.stderr ?? "";
|
|
@@ -563,7 +563,7 @@ async function runHook({ id, command, args, commandWithArgs, context, stream = f
|
|
|
563
563
|
success: false,
|
|
564
564
|
error: errorMessage
|
|
565
565
|
});
|
|
566
|
-
await context.emit("kubb:error", errorMessage);
|
|
566
|
+
await context.emit("kubb:error", { error: errorMessage });
|
|
567
567
|
}
|
|
568
568
|
}
|
|
569
569
|
//#endregion
|
|
@@ -631,7 +631,7 @@ const clackLogger = (0, _kubb_core.defineLogger)({
|
|
|
631
631
|
state.spinner.stop(text);
|
|
632
632
|
state.isSpinning = false;
|
|
633
633
|
}
|
|
634
|
-
context.on("kubb:info", (message, info = "") => {
|
|
634
|
+
context.on("kubb:info", ({ message, info = "" }) => {
|
|
635
635
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
636
636
|
const text = getMessage([
|
|
637
637
|
(0, node_util.styleText)("blue", "ℹ"),
|
|
@@ -641,7 +641,7 @@ const clackLogger = (0, _kubb_core.defineLogger)({
|
|
|
641
641
|
if (state.isSpinning) state.spinner.message(text);
|
|
642
642
|
else _clack_prompts.log.info(text);
|
|
643
643
|
});
|
|
644
|
-
context.on("kubb:success", (message, info = "") => {
|
|
644
|
+
context.on("kubb:success", ({ message, info = "" }) => {
|
|
645
645
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
646
646
|
const text = getMessage([
|
|
647
647
|
(0, node_util.styleText)("blue", "✓"),
|
|
@@ -651,7 +651,7 @@ const clackLogger = (0, _kubb_core.defineLogger)({
|
|
|
651
651
|
if (state.isSpinning) stopSpinner(text);
|
|
652
652
|
else _clack_prompts.log.success(text);
|
|
653
653
|
});
|
|
654
|
-
context.on("kubb:warn", (message, info) => {
|
|
654
|
+
context.on("kubb:warn", ({ message, info }) => {
|
|
655
655
|
if (logLevel < _kubb_core.logLevel.warn) return;
|
|
656
656
|
const text = getMessage([
|
|
657
657
|
(0, node_util.styleText)("yellow", "⚠"),
|
|
@@ -660,7 +660,7 @@ const clackLogger = (0, _kubb_core.defineLogger)({
|
|
|
660
660
|
].filter(Boolean).join(" "));
|
|
661
661
|
_clack_prompts.log.warn(text);
|
|
662
662
|
});
|
|
663
|
-
context.on("kubb:error", (error) => {
|
|
663
|
+
context.on("kubb:error", ({ error }) => {
|
|
664
664
|
const caused = require_errors.toCause(error);
|
|
665
665
|
const text = [(0, node_util.styleText)("red", "✗"), error.message].join(" ");
|
|
666
666
|
if (state.isSpinning) stopSpinner(getMessage(text));
|
|
@@ -675,10 +675,10 @@ const clackLogger = (0, _kubb_core.defineLogger)({
|
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
677
|
});
|
|
678
|
-
context.on("kubb:version:new", (
|
|
678
|
+
context.on("kubb:version:new", ({ currentVersion, latestVersion }) => {
|
|
679
679
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
680
680
|
try {
|
|
681
|
-
_clack_prompts.box(`\`v${
|
|
681
|
+
_clack_prompts.box(`\`v${currentVersion}\` → \`v${latestVersion}\`
|
|
682
682
|
Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
|
|
683
683
|
width: "auto",
|
|
684
684
|
formatBorder: (s) => (0, node_util.styleText)("yellow", s),
|
|
@@ -688,11 +688,11 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
|
|
|
688
688
|
titleAlign: "center"
|
|
689
689
|
});
|
|
690
690
|
} catch {
|
|
691
|
-
console.log(`Update available for Kubb: v${
|
|
691
|
+
console.log(`Update available for Kubb: v${currentVersion} → v${latestVersion}`);
|
|
692
692
|
console.log("Run `npm install -g @kubb/cli` to update");
|
|
693
693
|
}
|
|
694
694
|
});
|
|
695
|
-
context.on("kubb:lifecycle:start", async (version) => {
|
|
695
|
+
context.on("kubb:lifecycle:start", async ({ version }) => {
|
|
696
696
|
console.log(`\n${getIntro({
|
|
697
697
|
title: "The ultimate toolkit for working with APIs",
|
|
698
698
|
description: "Ready to start",
|
|
@@ -707,18 +707,18 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
|
|
|
707
707
|
_clack_prompts.intro(text);
|
|
708
708
|
startSpinner(getMessage("Configuration loading"));
|
|
709
709
|
});
|
|
710
|
-
context.on("kubb:config:end", (
|
|
710
|
+
context.on("kubb:config:end", () => {
|
|
711
711
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
712
712
|
const text = getMessage("Configuration completed");
|
|
713
713
|
_clack_prompts.outro(text);
|
|
714
714
|
});
|
|
715
|
-
context.on("kubb:generation:start", (config) => {
|
|
715
|
+
context.on("kubb:generation:start", ({ config }) => {
|
|
716
716
|
reset();
|
|
717
717
|
state.totalPlugins = config.plugins?.length ?? 0;
|
|
718
718
|
const text = getMessage(["Generation started", config.name ? `for ${(0, node_util.styleText)("dim", config.name)}` : void 0].filter(Boolean).join(" "));
|
|
719
719
|
_clack_prompts.intro(text);
|
|
720
720
|
});
|
|
721
|
-
context.on("kubb:plugin:start", (plugin) => {
|
|
721
|
+
context.on("kubb:plugin:start", ({ plugin }) => {
|
|
722
722
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
723
723
|
stopSpinner();
|
|
724
724
|
const progressBar = _clack_prompts.progress({
|
|
@@ -736,7 +736,7 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
|
|
|
736
736
|
interval
|
|
737
737
|
});
|
|
738
738
|
});
|
|
739
|
-
context.on("kubb:plugin:end", (plugin,
|
|
739
|
+
context.on("kubb:plugin:end", ({ plugin, duration, success }) => {
|
|
740
740
|
stopSpinner();
|
|
741
741
|
const active = state.activeProgress.get(plugin.name);
|
|
742
742
|
if (!active || logLevel === _kubb_core.logLevel.silent) return;
|
|
@@ -749,7 +749,7 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
|
|
|
749
749
|
state.activeProgress.delete(plugin.name);
|
|
750
750
|
showProgressStep();
|
|
751
751
|
});
|
|
752
|
-
context.on("kubb:files:processing:start", (files) => {
|
|
752
|
+
context.on("kubb:files:processing:start", ({ files }) => {
|
|
753
753
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
754
754
|
stopSpinner();
|
|
755
755
|
state.totalFiles = files.length;
|
|
@@ -760,7 +760,7 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
|
|
|
760
760
|
max: files.length,
|
|
761
761
|
size: 30
|
|
762
762
|
});
|
|
763
|
-
context.emit("kubb:info", text);
|
|
763
|
+
context.emit("kubb:info", { message: text });
|
|
764
764
|
progressBar.start(getMessage(text));
|
|
765
765
|
state.activeProgress.set("files", { progressBar });
|
|
766
766
|
});
|
|
@@ -783,7 +783,7 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
|
|
|
783
783
|
state.activeProgress.delete("files");
|
|
784
784
|
showProgressStep();
|
|
785
785
|
});
|
|
786
|
-
context.on("kubb:generation:end", (config) => {
|
|
786
|
+
context.on("kubb:generation:end", ({ config }) => {
|
|
787
787
|
const text = getMessage(config.name ? `Generation completed for ${(0, node_util.styleText)("dim", config.name)}` : "Generation completed");
|
|
788
788
|
_clack_prompts.outro(text);
|
|
789
789
|
});
|
|
@@ -847,7 +847,7 @@ Run \`npm install -g @kubb/cli\` to update`, "Update available for `Kubb`", {
|
|
|
847
847
|
const text = getMessage(`Hook ${(0, node_util.styleText)("dim", formatCommandWithArgs(command, args))} successfully executed`);
|
|
848
848
|
_clack_prompts.outro(text);
|
|
849
849
|
});
|
|
850
|
-
context.on("kubb:generation:summary", (config,
|
|
850
|
+
context.on("kubb:generation:summary", ({ config, pluginTimings, failedPlugins, filesCreated, status, hrStart }) => {
|
|
851
851
|
const summary = getSummary({
|
|
852
852
|
failedPlugins,
|
|
853
853
|
filesCreated,
|
|
@@ -917,25 +917,25 @@ const fileSystemLogger = (0, _kubb_core.defineLogger)({
|
|
|
917
917
|
for (const [fileName, logs] of Object.entries(files)) await write(fileName, logs.join("\n\n"));
|
|
918
918
|
return Object.keys(files);
|
|
919
919
|
}
|
|
920
|
-
context.on("kubb:info", (message, info) => {
|
|
920
|
+
context.on("kubb:info", ({ message, info }) => {
|
|
921
921
|
state.cachedLogs.add({
|
|
922
922
|
date: /* @__PURE__ */ new Date(),
|
|
923
923
|
logs: [`ℹ ${message} ${info}`]
|
|
924
924
|
});
|
|
925
925
|
});
|
|
926
|
-
context.on("kubb:success", (message, info) => {
|
|
926
|
+
context.on("kubb:success", ({ message, info }) => {
|
|
927
927
|
state.cachedLogs.add({
|
|
928
928
|
date: /* @__PURE__ */ new Date(),
|
|
929
929
|
logs: [`✓ ${message} ${info}`]
|
|
930
930
|
});
|
|
931
931
|
});
|
|
932
|
-
context.on("kubb:warn", (message, info) => {
|
|
932
|
+
context.on("kubb:warn", ({ message, info }) => {
|
|
933
933
|
state.cachedLogs.add({
|
|
934
934
|
date: /* @__PURE__ */ new Date(),
|
|
935
935
|
logs: [`⚠ ${message} ${info}`]
|
|
936
936
|
});
|
|
937
937
|
});
|
|
938
|
-
context.on("kubb:error", (error) => {
|
|
938
|
+
context.on("kubb:error", ({ error }) => {
|
|
939
939
|
state.cachedLogs.add({
|
|
940
940
|
date: /* @__PURE__ */ new Date(),
|
|
941
941
|
logs: [`✗ ${error.message}`, error.stack || "unknown stack"]
|
|
@@ -947,30 +947,33 @@ const fileSystemLogger = (0, _kubb_core.defineLogger)({
|
|
|
947
947
|
logs: message.logs
|
|
948
948
|
});
|
|
949
949
|
});
|
|
950
|
-
context.on("kubb:plugin:start", (plugin) => {
|
|
950
|
+
context.on("kubb:plugin:start", ({ plugin }) => {
|
|
951
951
|
state.cachedLogs.add({
|
|
952
952
|
date: /* @__PURE__ */ new Date(),
|
|
953
953
|
logs: [`Generating ${plugin.name}`]
|
|
954
954
|
});
|
|
955
955
|
});
|
|
956
|
-
context.on("kubb:plugin:end", (plugin,
|
|
956
|
+
context.on("kubb:plugin:end", ({ plugin, duration, success }) => {
|
|
957
957
|
const durationStr = formatMs(duration);
|
|
958
958
|
state.cachedLogs.add({
|
|
959
959
|
date: /* @__PURE__ */ new Date(),
|
|
960
960
|
logs: [success ? `${plugin.name} completed in ${durationStr}` : `${plugin.name} failed in ${durationStr}`]
|
|
961
961
|
});
|
|
962
962
|
});
|
|
963
|
-
context.on("kubb:files:processing:start", (files) => {
|
|
963
|
+
context.on("kubb:files:processing:start", ({ files }) => {
|
|
964
964
|
state.cachedLogs.add({
|
|
965
965
|
date: /* @__PURE__ */ new Date(),
|
|
966
966
|
logs: [`Start ${files.length} writing:`, ...files.map((file) => file.path)]
|
|
967
967
|
});
|
|
968
968
|
});
|
|
969
|
-
context.on("kubb:generation:end", async (config) => {
|
|
969
|
+
context.on("kubb:generation:end", async ({ config }) => {
|
|
970
970
|
const writtenFilePaths = await writeLogs(config.name);
|
|
971
971
|
if (writtenFilePaths.length > 0) {
|
|
972
972
|
const files = writtenFilePaths.map((f) => (0, node_path.relative)(node_process.default.cwd(), f));
|
|
973
|
-
await context.emit("kubb:info",
|
|
973
|
+
await context.emit("kubb:info", {
|
|
974
|
+
message: "Debug files written to:",
|
|
975
|
+
info: files.join(", ")
|
|
976
|
+
});
|
|
974
977
|
}
|
|
975
978
|
reset();
|
|
976
979
|
});
|
|
@@ -1024,7 +1027,7 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1024
1027
|
function closeGroup(_name) {
|
|
1025
1028
|
console.log("::endgroup::");
|
|
1026
1029
|
}
|
|
1027
|
-
context.on("kubb:info", (message, info = "") => {
|
|
1030
|
+
context.on("kubb:info", ({ message, info = "" }) => {
|
|
1028
1031
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1029
1032
|
const text = getMessage([
|
|
1030
1033
|
(0, node_util.styleText)("blue", "ℹ"),
|
|
@@ -1033,7 +1036,7 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1033
1036
|
].join(" "));
|
|
1034
1037
|
console.log(text);
|
|
1035
1038
|
});
|
|
1036
|
-
context.on("kubb:success", (message, info = "") => {
|
|
1039
|
+
context.on("kubb:success", ({ message, info = "" }) => {
|
|
1037
1040
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1038
1041
|
const text = getMessage([
|
|
1039
1042
|
(0, node_util.styleText)("blue", "✓"),
|
|
@@ -1042,7 +1045,7 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1042
1045
|
].filter(Boolean).join(" "));
|
|
1043
1046
|
console.log(text);
|
|
1044
1047
|
});
|
|
1045
|
-
context.on("kubb:warn", (message, info = "") => {
|
|
1048
|
+
context.on("kubb:warn", ({ message, info = "" }) => {
|
|
1046
1049
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1047
1050
|
const text = getMessage([
|
|
1048
1051
|
(0, node_util.styleText)("yellow", "⚠"),
|
|
@@ -1051,7 +1054,7 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1051
1054
|
].filter(Boolean).join(" "));
|
|
1052
1055
|
console.warn(`::warning::${text}`);
|
|
1053
1056
|
});
|
|
1054
|
-
context.on("kubb:error", (error) => {
|
|
1057
|
+
context.on("kubb:error", ({ error }) => {
|
|
1055
1058
|
const caused = require_errors.toCause(error);
|
|
1056
1059
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1057
1060
|
const message = error.message || String(error);
|
|
@@ -1066,7 +1069,7 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1066
1069
|
}
|
|
1067
1070
|
}
|
|
1068
1071
|
});
|
|
1069
|
-
context.on("kubb:lifecycle:start", (version) => {
|
|
1072
|
+
context.on("kubb:lifecycle:start", ({ version }) => {
|
|
1070
1073
|
console.log((0, node_util.styleText)("yellow", `Kubb ${version} 🧩`));
|
|
1071
1074
|
reset();
|
|
1072
1075
|
});
|
|
@@ -1076,27 +1079,27 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1076
1079
|
openGroup("Configuration");
|
|
1077
1080
|
console.log(text);
|
|
1078
1081
|
});
|
|
1079
|
-
context.on("kubb:config:end", (configs) => {
|
|
1082
|
+
context.on("kubb:config:end", ({ configs }) => {
|
|
1080
1083
|
state.currentConfigs = configs;
|
|
1081
1084
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1082
1085
|
const text = getMessage("Configuration completed");
|
|
1083
1086
|
console.log(text);
|
|
1084
1087
|
closeGroup("Configuration");
|
|
1085
1088
|
});
|
|
1086
|
-
context.on("kubb:generation:start", (config) => {
|
|
1089
|
+
context.on("kubb:generation:start", ({ config }) => {
|
|
1087
1090
|
reset();
|
|
1088
1091
|
state.totalPlugins = config.plugins?.length ?? 0;
|
|
1089
1092
|
const text = config.name ? `Generation for ${(0, node_util.styleText)("bold", config.name)}` : "Generation";
|
|
1090
1093
|
if (state.currentConfigs.length > 1) openGroup(text);
|
|
1091
1094
|
if (state.currentConfigs.length === 1) console.log(getMessage(text));
|
|
1092
1095
|
});
|
|
1093
|
-
context.on("kubb:plugin:start", (plugin) => {
|
|
1096
|
+
context.on("kubb:plugin:start", ({ plugin }) => {
|
|
1094
1097
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1095
1098
|
const text = getMessage(`Generating ${(0, node_util.styleText)("bold", plugin.name)}`);
|
|
1096
1099
|
if (state.currentConfigs.length === 1) openGroup(`Plugin: ${plugin.name}`);
|
|
1097
1100
|
console.log(text);
|
|
1098
1101
|
});
|
|
1099
|
-
context.on("kubb:plugin:end", (plugin,
|
|
1102
|
+
context.on("kubb:plugin:end", ({ plugin, duration, success }) => {
|
|
1100
1103
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1101
1104
|
if (success) state.completedPlugins++;
|
|
1102
1105
|
else state.failedPlugins++;
|
|
@@ -1107,7 +1110,7 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1107
1110
|
if (state.currentConfigs.length === 1) closeGroup(`Plugin: ${plugin.name}`);
|
|
1108
1111
|
showProgressStep();
|
|
1109
1112
|
});
|
|
1110
|
-
context.on("kubb:files:processing:start", (files) => {
|
|
1113
|
+
context.on("kubb:files:processing:start", ({ files }) => {
|
|
1111
1114
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1112
1115
|
state.totalFiles = files.length;
|
|
1113
1116
|
state.processedFiles = 0;
|
|
@@ -1126,7 +1129,7 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1126
1129
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1127
1130
|
state.processedFiles++;
|
|
1128
1131
|
});
|
|
1129
|
-
context.on("kubb:generation:end", (config) => {
|
|
1132
|
+
context.on("kubb:generation:end", ({ config }) => {
|
|
1130
1133
|
const text = getMessage(config.name ? `${(0, node_util.styleText)("blue", "✓")} Generation completed for ${(0, node_util.styleText)("dim", config.name)}` : `${(0, node_util.styleText)("blue", "✓")} Generation completed`);
|
|
1131
1134
|
console.log(text);
|
|
1132
1135
|
});
|
|
@@ -1181,7 +1184,7 @@ const githubActionsLogger = (0, _kubb_core.defineLogger)({
|
|
|
1181
1184
|
console.log(text);
|
|
1182
1185
|
if (state.currentConfigs.length === 1) closeGroup(`Hook ${commandWithArgs}`);
|
|
1183
1186
|
});
|
|
1184
|
-
context.on("kubb:generation:summary", (config,
|
|
1187
|
+
context.on("kubb:generation:summary", ({ config, status, hrStart, failedPlugins }) => {
|
|
1185
1188
|
const pluginsCount = config.plugins?.length ?? 0;
|
|
1186
1189
|
const successCount = pluginsCount - failedPlugins.size;
|
|
1187
1190
|
const duration = formatHrtime(hrStart);
|
|
@@ -1207,7 +1210,7 @@ const plainLogger = (0, _kubb_core.defineLogger)({
|
|
|
1207
1210
|
function getMessage(message) {
|
|
1208
1211
|
return formatMessage(message, logLevel);
|
|
1209
1212
|
}
|
|
1210
|
-
context.on("kubb:info", (message, info) => {
|
|
1213
|
+
context.on("kubb:info", ({ message, info }) => {
|
|
1211
1214
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1212
1215
|
const text = getMessage([
|
|
1213
1216
|
"ℹ",
|
|
@@ -1216,7 +1219,7 @@ const plainLogger = (0, _kubb_core.defineLogger)({
|
|
|
1216
1219
|
].join(" "));
|
|
1217
1220
|
console.log(text);
|
|
1218
1221
|
});
|
|
1219
|
-
context.on("kubb:success", (message, info = "") => {
|
|
1222
|
+
context.on("kubb:success", ({ message, info = "" }) => {
|
|
1220
1223
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1221
1224
|
const text = getMessage([
|
|
1222
1225
|
"✓",
|
|
@@ -1225,7 +1228,7 @@ const plainLogger = (0, _kubb_core.defineLogger)({
|
|
|
1225
1228
|
].filter(Boolean).join(" "));
|
|
1226
1229
|
console.log(text);
|
|
1227
1230
|
});
|
|
1228
|
-
context.on("kubb:warn", (message, info) => {
|
|
1231
|
+
context.on("kubb:warn", ({ message, info }) => {
|
|
1229
1232
|
if (logLevel < _kubb_core.logLevel.warn) return;
|
|
1230
1233
|
const text = getMessage([
|
|
1231
1234
|
"⚠",
|
|
@@ -1234,7 +1237,7 @@ const plainLogger = (0, _kubb_core.defineLogger)({
|
|
|
1234
1237
|
].filter(Boolean).join(" "));
|
|
1235
1238
|
console.log(text);
|
|
1236
1239
|
});
|
|
1237
|
-
context.on("kubb:error", (error) => {
|
|
1240
|
+
context.on("kubb:error", ({ error }) => {
|
|
1238
1241
|
const caused = require_errors.toCause(error);
|
|
1239
1242
|
const text = getMessage(["✗", error.message].join(" "));
|
|
1240
1243
|
console.log(text);
|
|
@@ -1265,18 +1268,18 @@ const plainLogger = (0, _kubb_core.defineLogger)({
|
|
|
1265
1268
|
const text = getMessage("Generation started");
|
|
1266
1269
|
console.log(text);
|
|
1267
1270
|
});
|
|
1268
|
-
context.on("kubb:plugin:start", (plugin) => {
|
|
1271
|
+
context.on("kubb:plugin:start", ({ plugin }) => {
|
|
1269
1272
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1270
1273
|
const text = getMessage(`Generating ${plugin.name}`);
|
|
1271
1274
|
console.log(text);
|
|
1272
1275
|
});
|
|
1273
|
-
context.on("kubb:plugin:end", (plugin,
|
|
1276
|
+
context.on("kubb:plugin:end", ({ plugin, duration, success }) => {
|
|
1274
1277
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1275
1278
|
const durationStr = formatMs(duration);
|
|
1276
1279
|
const text = getMessage(success ? `${plugin.name} completed in ${durationStr}` : `${plugin.name} failed in ${durationStr}`);
|
|
1277
1280
|
console.log(text);
|
|
1278
1281
|
});
|
|
1279
|
-
context.on("kubb:files:processing:start", (files) => {
|
|
1282
|
+
context.on("kubb:files:processing:start", ({ files }) => {
|
|
1280
1283
|
if (logLevel <= _kubb_core.logLevel.silent) return;
|
|
1281
1284
|
const text = getMessage(`Writing ${files.length} files`);
|
|
1282
1285
|
console.log(text);
|
|
@@ -1291,7 +1294,7 @@ const plainLogger = (0, _kubb_core.defineLogger)({
|
|
|
1291
1294
|
const text = getMessage("Files written successfully");
|
|
1292
1295
|
console.log(text);
|
|
1293
1296
|
});
|
|
1294
|
-
context.on("kubb:generation:end", (config) => {
|
|
1297
|
+
context.on("kubb:generation:end", ({ config }) => {
|
|
1295
1298
|
const text = getMessage(config.name ? `Generation completed for ${config.name}` : "Generation completed");
|
|
1296
1299
|
console.log(text);
|
|
1297
1300
|
});
|
|
@@ -1337,7 +1340,7 @@ const plainLogger = (0, _kubb_core.defineLogger)({
|
|
|
1337
1340
|
const text = getMessage(`Hook ${formatCommandWithArgs(command, args)} completed`);
|
|
1338
1341
|
console.log(text);
|
|
1339
1342
|
});
|
|
1340
|
-
context.on("kubb:generation:summary", (config,
|
|
1343
|
+
context.on("kubb:generation:summary", ({ config, pluginTimings, status, hrStart, failedPlugins, filesCreated }) => {
|
|
1341
1344
|
const summary = getSummary({
|
|
1342
1345
|
failedPlugins,
|
|
1343
1346
|
filesCreated,
|
|
@@ -1417,14 +1420,14 @@ async function executeHooks({ configHooks, hooks }) {
|
|
|
1417
1420
|
if (!cmd) continue;
|
|
1418
1421
|
const hookId = (0, node_crypto.createHash)("sha256").update(command).digest("hex");
|
|
1419
1422
|
const hookEndPromise = new Promise((resolve, reject) => {
|
|
1420
|
-
const handler = (
|
|
1421
|
-
if (id !== hookId) return;
|
|
1423
|
+
const handler = (ctx) => {
|
|
1424
|
+
if (ctx.id !== hookId) return;
|
|
1422
1425
|
hooks.off("kubb:hook:end", handler);
|
|
1423
|
-
if (!success) {
|
|
1424
|
-
reject(error ?? /* @__PURE__ */ new Error(`Hook failed: ${command}`));
|
|
1426
|
+
if (!ctx.success) {
|
|
1427
|
+
reject(ctx.error ?? /* @__PURE__ */ new Error(`Hook failed: ${command}`));
|
|
1425
1428
|
return;
|
|
1426
1429
|
}
|
|
1427
|
-
hooks.emit("kubb:success", `${(0, node_util.styleText)("dim", command)} successfully executed`).then(resolve).catch(reject);
|
|
1430
|
+
hooks.emit("kubb:success", { message: `${(0, node_util.styleText)("dim", command)} successfully executed` }).then(resolve).catch(reject);
|
|
1428
1431
|
};
|
|
1429
1432
|
hooks.on("kubb:hook:end", handler);
|
|
1430
1433
|
});
|
|
@@ -1527,10 +1530,10 @@ async function runToolPass({ toolValue, detect, toolMap, toolLabel, successPrefi
|
|
|
1527
1530
|
let resolvedTool = toolValue;
|
|
1528
1531
|
if (resolvedTool === "auto") {
|
|
1529
1532
|
const detected = await detect();
|
|
1530
|
-
if (!detected) await hooks.emit("kubb:warn", noToolMessage);
|
|
1533
|
+
if (!detected) await hooks.emit("kubb:warn", { message: noToolMessage });
|
|
1531
1534
|
else {
|
|
1532
1535
|
resolvedTool = detected;
|
|
1533
|
-
await hooks.emit("kubb:info", `Auto-detected ${toolLabel}: ${(0, node_util.styleText)("dim", resolvedTool)}`);
|
|
1536
|
+
await hooks.emit("kubb:info", { message: `Auto-detected ${toolLabel}: ${(0, node_util.styleText)("dim", resolvedTool)}` });
|
|
1534
1537
|
}
|
|
1535
1538
|
}
|
|
1536
1539
|
let toolError;
|
|
@@ -1539,18 +1542,18 @@ async function runToolPass({ toolValue, detect, toolMap, toolLabel, successPrefi
|
|
|
1539
1542
|
try {
|
|
1540
1543
|
const hookId = (0, node_crypto.createHash)("sha256").update([configName, resolvedTool].filter(Boolean).join("-")).digest("hex");
|
|
1541
1544
|
const hookEndPromise = new Promise((resolve, reject) => {
|
|
1542
|
-
const handler = (
|
|
1543
|
-
if (id !== hookId) return;
|
|
1545
|
+
const handler = (ctx) => {
|
|
1546
|
+
if (ctx.id !== hookId) return;
|
|
1544
1547
|
hooks.off("kubb:hook:end", handler);
|
|
1545
|
-
if (!success) {
|
|
1546
|
-
reject(error ?? /* @__PURE__ */ new Error(`${toolConfig.errorMessage}`));
|
|
1548
|
+
if (!ctx.success) {
|
|
1549
|
+
reject(ctx.error ?? /* @__PURE__ */ new Error(`${toolConfig.errorMessage}`));
|
|
1547
1550
|
return;
|
|
1548
1551
|
}
|
|
1549
|
-
hooks.emit("kubb:success", [
|
|
1552
|
+
hooks.emit("kubb:success", { message: [
|
|
1550
1553
|
`${successPrefix} with ${(0, node_util.styleText)("dim", resolvedTool)}`,
|
|
1551
1554
|
logLevel >= _kubb_core.logLevel.info ? `on ${(0, node_util.styleText)("dim", outputPath)}` : void 0,
|
|
1552
1555
|
"successfully"
|
|
1553
|
-
].filter(Boolean).join(" ")).then(resolve).catch(reject);
|
|
1556
|
+
].filter(Boolean).join(" ") }).then(resolve).catch(reject);
|
|
1554
1557
|
};
|
|
1555
1558
|
hooks.on("kubb:hook:end", handler);
|
|
1556
1559
|
});
|
|
@@ -1562,7 +1565,7 @@ async function runToolPass({ toolValue, detect, toolMap, toolLabel, successPrefi
|
|
|
1562
1565
|
await hookEndPromise;
|
|
1563
1566
|
} catch (caughtError) {
|
|
1564
1567
|
const err = require_errors.toError(caughtError);
|
|
1565
|
-
await hooks.emit("kubb:error", err);
|
|
1568
|
+
await hooks.emit("kubb:error", { error: err });
|
|
1566
1569
|
toolError = err;
|
|
1567
1570
|
}
|
|
1568
1571
|
}
|
|
@@ -1583,16 +1586,27 @@ async function generate(options) {
|
|
|
1583
1586
|
};
|
|
1584
1587
|
const kubb = (0, _kubb_core.createKubb)(config, { hooks });
|
|
1585
1588
|
await kubb.setup();
|
|
1586
|
-
await hooks.emit("kubb:generation:start", config);
|
|
1587
|
-
await hooks.emit("kubb:info",
|
|
1588
|
-
|
|
1589
|
+
await hooks.emit("kubb:generation:start", { config });
|
|
1590
|
+
await hooks.emit("kubb:info", {
|
|
1591
|
+
message: config.name ? `Setup generation ${(0, node_util.styleText)("bold", config.name)}` : "Setup generation",
|
|
1592
|
+
info: inputPath
|
|
1593
|
+
});
|
|
1594
|
+
await hooks.emit("kubb:info", {
|
|
1595
|
+
message: config.name ? `Build generation ${(0, node_util.styleText)("bold", config.name)}` : "Build generation",
|
|
1596
|
+
info: inputPath
|
|
1597
|
+
});
|
|
1589
1598
|
const { files, failedPlugins, pluginTimings, error, driver } = await kubb.safeBuild();
|
|
1590
|
-
await hooks.emit("kubb:info", "Load summary");
|
|
1599
|
+
await hooks.emit("kubb:info", { message: "Load summary" });
|
|
1591
1600
|
if (failedPlugins.size > 0 || error) {
|
|
1592
1601
|
const allErrors = [error, ...Array.from(failedPlugins).filter((it) => it.error).map((it) => it.error)].filter(Boolean);
|
|
1593
|
-
for (const err of allErrors) await hooks.emit("kubb:error", err);
|
|
1594
|
-
await hooks.emit("kubb:generation:end",
|
|
1595
|
-
|
|
1602
|
+
for (const err of allErrors) await hooks.emit("kubb:error", { error: err });
|
|
1603
|
+
await hooks.emit("kubb:generation:end", {
|
|
1604
|
+
config,
|
|
1605
|
+
files,
|
|
1606
|
+
sources: kubb.sources
|
|
1607
|
+
});
|
|
1608
|
+
await hooks.emit("kubb:generation:summary", {
|
|
1609
|
+
config,
|
|
1596
1610
|
failedPlugins,
|
|
1597
1611
|
filesCreated: files.length,
|
|
1598
1612
|
status: "failed",
|
|
@@ -1612,8 +1626,15 @@ async function generate(options) {
|
|
|
1612
1626
|
}));
|
|
1613
1627
|
node_process.default.exit(1);
|
|
1614
1628
|
}
|
|
1615
|
-
await hooks.emit("kubb:success",
|
|
1616
|
-
|
|
1629
|
+
await hooks.emit("kubb:success", {
|
|
1630
|
+
message: "Generation successfully",
|
|
1631
|
+
info: inputPath
|
|
1632
|
+
});
|
|
1633
|
+
await hooks.emit("kubb:generation:end", {
|
|
1634
|
+
config,
|
|
1635
|
+
files,
|
|
1636
|
+
sources: kubb.sources
|
|
1637
|
+
});
|
|
1617
1638
|
const outputPath = node_path.default.resolve(config.root, config.output.path);
|
|
1618
1639
|
if (config.output.format) await runToolPass({
|
|
1619
1640
|
toolValue: config.output.format,
|
|
@@ -1651,7 +1672,8 @@ async function generate(options) {
|
|
|
1651
1672
|
});
|
|
1652
1673
|
await hooks.emit("kubb:hooks:end");
|
|
1653
1674
|
}
|
|
1654
|
-
await hooks.emit("kubb:generation:summary",
|
|
1675
|
+
await hooks.emit("kubb:generation:summary", {
|
|
1676
|
+
config,
|
|
1655
1677
|
failedPlugins,
|
|
1656
1678
|
filesCreated: files.length,
|
|
1657
1679
|
status: "success",
|
|
@@ -1677,17 +1699,26 @@ async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, wa
|
|
|
1677
1699
|
await require_telemetry.executeIfOnline(async () => {
|
|
1678
1700
|
try {
|
|
1679
1701
|
const latestVersion = (await (await fetch(require_constants.KUBB_NPM_PACKAGE_URL)).json()).version;
|
|
1680
|
-
if (latestVersion && require_package.version < latestVersion) await hooks.emit("kubb:version:new",
|
|
1702
|
+
if (latestVersion && require_package.version < latestVersion) await hooks.emit("kubb:version:new", {
|
|
1703
|
+
currentVersion: require_package.version,
|
|
1704
|
+
latestVersion
|
|
1705
|
+
});
|
|
1681
1706
|
} catch {}
|
|
1682
1707
|
});
|
|
1683
1708
|
try {
|
|
1684
1709
|
const result = await getCosmiConfig("kubb", configPath);
|
|
1685
1710
|
const configs = await getConfigs(result.config, { input });
|
|
1686
1711
|
await hooks.emit("kubb:config:start");
|
|
1687
|
-
await hooks.emit("kubb:info",
|
|
1688
|
-
|
|
1689
|
-
|
|
1690
|
-
|
|
1712
|
+
await hooks.emit("kubb:info", {
|
|
1713
|
+
message: "Config loaded",
|
|
1714
|
+
info: node_path.default.relative(node_process.default.cwd(), result.filepath)
|
|
1715
|
+
});
|
|
1716
|
+
await hooks.emit("kubb:success", {
|
|
1717
|
+
message: "Config loaded successfully",
|
|
1718
|
+
info: node_path.default.relative(node_process.default.cwd(), result.filepath)
|
|
1719
|
+
});
|
|
1720
|
+
await hooks.emit("kubb:config:end", { configs });
|
|
1721
|
+
await hooks.emit("kubb:lifecycle:start", { version: require_package.version });
|
|
1691
1722
|
for (const config of configs) if ((0, _kubb_core.isInputPath)(config) && watch) await startWatcher([input || config.input.path], async (paths) => {
|
|
1692
1723
|
hooks.removeAll();
|
|
1693
1724
|
await generate({
|
|
@@ -1706,11 +1737,11 @@ async function runGenerateCommand({ input, configPath, logLevel: logLevelKey, wa
|
|
|
1706
1737
|
});
|
|
1707
1738
|
await hooks.emit("kubb:lifecycle:end");
|
|
1708
1739
|
} catch (error) {
|
|
1709
|
-
await hooks.emit("kubb:error", require_errors.toError(error));
|
|
1740
|
+
await hooks.emit("kubb:error", { error: require_errors.toError(error) });
|
|
1710
1741
|
node_process.default.exit(1);
|
|
1711
1742
|
}
|
|
1712
1743
|
}
|
|
1713
1744
|
//#endregion
|
|
1714
1745
|
exports.runGenerateCommand = runGenerateCommand;
|
|
1715
1746
|
|
|
1716
|
-
//# sourceMappingURL=generate-
|
|
1747
|
+
//# sourceMappingURL=generate-BxzJaEso.cjs.map
|