@kubb/cli 5.9.3 → 5.9.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/Telemetry-ByFeVTz5.cjs +314 -0
- package/dist/Telemetry-ByFeVTz5.cjs.map +1 -0
- package/dist/Telemetry-E_BBHmnT.js +259 -0
- package/dist/Telemetry-E_BBHmnT.js.map +1 -0
- package/dist/background-CZ2nVKwB.js +1 -0
- package/dist/{background-BcRoKru0.cjs → background-DdUVvDwi.cjs} +7 -6
- package/dist/{background-BcRoKru0.cjs.map → background-DdUVvDwi.cjs.map} +1 -1
- package/dist/{background-CCex47-d.js → background-H30JH70B.js} +3 -2
- package/dist/{background-CCex47-d.js.map → background-H30JH70B.js.map} +1 -1
- package/dist/{reporters-B4rZOlo8.cjs → config-Ck2JHe5r.cjs} +36 -4
- package/dist/config-Ck2JHe5r.cjs.map +1 -0
- package/dist/{reporters-H21Jvrff.js → config-DxePdyxe.js} +29 -3
- package/dist/config-DxePdyxe.js.map +1 -0
- package/dist/credentials-C8tjAhTo.js +1 -0
- package/dist/credentials-CZK6zPLv.js +62 -0
- package/dist/credentials-CZK6zPLv.js.map +1 -0
- package/dist/credentials-DDaKqtJn.cjs +113 -0
- package/dist/credentials-DDaKqtJn.cjs.map +1 -0
- package/dist/index.cjs +702 -208
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +697 -207
- package/dist/index.js.map +1 -1
- package/dist/{output-BnK0scpX.cjs → output-Cd3Kmvo0.cjs} +141 -66
- package/dist/output-Cd3Kmvo0.cjs.map +1 -0
- package/dist/{output-qFt4vV7K.js → output-DS5hyqwL.js} +173 -129
- package/dist/output-DS5hyqwL.js.map +1 -0
- package/dist/{registry-B7BvdrGE.js → registry-CSXUuuCy.js} +2 -2
- package/dist/{registry-B7BvdrGE.js.map → registry-CSXUuuCy.js.map} +1 -1
- package/dist/{registry-DER9aRyg.cjs → registry-CrvQxnxy.cjs} +6 -6
- package/dist/{registry-DER9aRyg.cjs.map → registry-CrvQxnxy.cjs.map} +1 -1
- package/dist/rolldown-runtime-CPE0t6oh.cjs +53 -0
- package/dist/{run-QPsBYkq_.js → run-BPD5Vaon.js} +5 -7
- package/dist/{run-QPsBYkq_.js.map → run-BPD5Vaon.js.map} +1 -1
- package/dist/{run-Co732JNO.cjs → run-C0Tfrddq.cjs} +5 -6
- package/dist/{run-Co732JNO.cjs.map → run-C0Tfrddq.cjs.map} +1 -1
- package/dist/{run-DFos0eOY.cjs → run-CbN00IHp.cjs} +16 -18
- package/dist/{run-DFos0eOY.cjs.map → run-CbN00IHp.cjs.map} +1 -1
- package/dist/{run-B1jaQu6Q.js → run-CecrPSop.js} +2 -3
- package/dist/{run-B1jaQu6Q.js.map → run-CecrPSop.js.map} +1 -1
- package/dist/{run-DunTcXOS.js → run-Ck04_W4q.js} +2 -3
- package/dist/{run-DunTcXOS.js.map → run-Ck04_W4q.js.map} +1 -1
- package/dist/{run-BRUwQ5Y7.js → run-DcP1czVQ.js} +25 -84
- package/dist/run-DcP1czVQ.js.map +1 -0
- package/dist/{run-CIvFRMLt.cjs → run-Dyc52IzX.cjs} +5 -6
- package/dist/{run-CIvFRMLt.cjs.map → run-Dyc52IzX.cjs.map} +1 -1
- package/dist/{run-DxGkjzRm.cjs → run-QqLDhthl.cjs} +46 -158
- package/dist/run-QqLDhthl.cjs.map +1 -0
- package/dist/run-WkXSXG2V.js +1 -0
- package/dist/{snapshot-DUJU70H_.cjs → snapshot-NGLcfG6E.cjs} +17 -26
- package/dist/snapshot-NGLcfG6E.cjs.map +1 -0
- package/dist/{snapshot-CkpJr-gr.js → snapshot-iEjgROga.js} +15 -24
- package/dist/snapshot-iEjgROga.js.map +1 -0
- package/dist/studioWorker.js +2 -2
- package/package.json +7 -8
- package/dist/Telemetry-C9gmBTr0.cjs +0 -231
- package/dist/Telemetry-C9gmBTr0.cjs.map +0 -1
- package/dist/Telemetry-CSc7OVsv.js +0 -207
- package/dist/Telemetry-CSc7OVsv.js.map +0 -1
- package/dist/agent-BPIqnEl2.js +0 -59
- package/dist/agent-BPIqnEl2.js.map +0 -1
- package/dist/agent-DElUuYuy.cjs +0 -120
- package/dist/agent-DElUuYuy.cjs.map +0 -1
- package/dist/background-1AFVK_yN.js +0 -1
- package/dist/commands-BuY0nrlU.cjs +0 -87
- package/dist/commands-BuY0nrlU.cjs.map +0 -1
- package/dist/commands-atq2z0Bo.js +0 -81
- package/dist/commands-atq2z0Bo.js.map +0 -1
- package/dist/config-B6UIKcl1.js +0 -117
- package/dist/config-B6UIKcl1.js.map +0 -1
- package/dist/config-Bo9ro7vg.cjs +0 -129
- package/dist/config-Bo9ro7vg.cjs.map +0 -1
- package/dist/constants-Cii4HX64.js +0 -12
- package/dist/constants-Cii4HX64.js.map +0 -1
- package/dist/constants-Df449N47.cjs +0 -29
- package/dist/constants-Df449N47.cjs.map +0 -1
- package/dist/errors-BdA8M78q.cjs +0 -43
- package/dist/errors-BdA8M78q.cjs.map +0 -1
- package/dist/errors-DmC83ALX.js +0 -32
- package/dist/errors-DmC83ALX.js.map +0 -1
- package/dist/output-BnK0scpX.cjs.map +0 -1
- package/dist/output-qFt4vV7K.js.map +0 -1
- package/dist/reporters-B4rZOlo8.cjs.map +0 -1
- package/dist/reporters-H21Jvrff.js.map +0 -1
- package/dist/run-BGTUbY2h.cjs +0 -130
- package/dist/run-BGTUbY2h.cjs.map +0 -1
- package/dist/run-BPQzGEIs.js +0 -178
- package/dist/run-BPQzGEIs.js.map +0 -1
- package/dist/run-BRUwQ5Y7.js.map +0 -1
- package/dist/run-BYff_byB.js +0 -71
- package/dist/run-BYff_byB.js.map +0 -1
- package/dist/run-Bhs7mJ1f.cjs +0 -79
- package/dist/run-Bhs7mJ1f.cjs.map +0 -1
- package/dist/run-CH48n-MJ.js +0 -1
- package/dist/run-DfEoWJuy.js +0 -126
- package/dist/run-DfEoWJuy.js.map +0 -1
- package/dist/run-Dm9OZUkQ.cjs +0 -182
- package/dist/run-Dm9OZUkQ.cjs.map +0 -1
- package/dist/run-DpAMfkm5.cjs +0 -72
- package/dist/run-DpAMfkm5.cjs.map +0 -1
- package/dist/run-DxGkjzRm.cjs.map +0 -1
- package/dist/run-DxxYCqEo.js +0 -77
- package/dist/run-DxxYCqEo.js.map +0 -1
- package/dist/snapshot-CkpJr-gr.js.map +0 -1
- package/dist/snapshot-DUJU70H_.cjs.map +0 -1
- package/dist/utils-BHW8kA8P.js +0 -83
- package/dist/utils-BHW8kA8P.js.map +0 -1
- package/dist/utils-BzQ46pgd.cjs +0 -109
- package/dist/utils-BzQ46pgd.cjs.map +0 -1
package/dist/run-BYff_byB.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import { t as getErrorMessage } from "./errors-DmC83ALX.js";
|
|
3
|
-
import { d as logWarn, i as logError, r as logBlock, s as logOutro } from "./output-qFt4vV7K.js";
|
|
4
|
-
import { a as isOutdated, n as fetchRegistryIndex, o as registryUrl } from "./registry-B7BvdrGE.js";
|
|
5
|
-
import { styleText } from "node:util";
|
|
6
|
-
import process from "node:process";
|
|
7
|
-
import { readInstalledPackages } from "@kubb/core";
|
|
8
|
-
//#region src/runners/list/run.ts
|
|
9
|
-
/**
|
|
10
|
-
* The installed packages that ship a `kubb-extension.json` or have a registry entry, with the
|
|
11
|
-
* version the registry pins.
|
|
12
|
-
*/
|
|
13
|
-
async function listExtensions({ cwd, registry }) {
|
|
14
|
-
const [installed, entries] = await Promise.all([readInstalledPackages({ root: cwd }), fetchRegistryIndex({ registry }).catch((error) => {
|
|
15
|
-
logWarn(`Showing installed extensions only: ${getErrorMessage(error)}`);
|
|
16
|
-
return [];
|
|
17
|
-
})]);
|
|
18
|
-
const byPackage = new Map(entries.map((entry) => [entry.artifact.package, entry]));
|
|
19
|
-
return installed.flatMap(({ package: name, version, manifest }) => {
|
|
20
|
-
const entry = byPackage.get(name);
|
|
21
|
-
if (!entry && !manifest) return [];
|
|
22
|
-
const latest = entry?.artifact.version;
|
|
23
|
-
return [{
|
|
24
|
-
id: entry?.id,
|
|
25
|
-
package: name,
|
|
26
|
-
installed: version,
|
|
27
|
-
registry: latest,
|
|
28
|
-
update: !!latest && isOutdated({
|
|
29
|
-
installed: version,
|
|
30
|
-
latest
|
|
31
|
-
})
|
|
32
|
-
}];
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
/** Prints the installed extensions as a table. */
|
|
36
|
-
async function run() {
|
|
37
|
-
try {
|
|
38
|
-
const rows = await listExtensions({
|
|
39
|
-
cwd: process.cwd(),
|
|
40
|
-
registry: registryUrl()
|
|
41
|
-
});
|
|
42
|
-
if (!rows.length) {
|
|
43
|
-
logOutro("No installed extensions found.");
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
const header = [
|
|
47
|
-
"ID",
|
|
48
|
-
"PACKAGE",
|
|
49
|
-
"INSTALLED",
|
|
50
|
-
"REGISTRY",
|
|
51
|
-
"UPDATE"
|
|
52
|
-
];
|
|
53
|
-
const cells = rows.map((row) => [
|
|
54
|
-
row.id ?? "-",
|
|
55
|
-
row.package,
|
|
56
|
-
row.installed ?? "-",
|
|
57
|
-
row.registry ?? "-",
|
|
58
|
-
row.update ? "yes" : "no"
|
|
59
|
-
]);
|
|
60
|
-
const widths = header.map((title, index) => Math.max(title.length, ...cells.map((cell) => cell[index].length)));
|
|
61
|
-
const line = (cell) => cell.map((value, index) => value.padEnd(widths[index])).join(" ").trimEnd();
|
|
62
|
-
logBlock([styleText("dim", line(header)), ...cells.map(line)]);
|
|
63
|
-
} catch (error) {
|
|
64
|
-
logError(getErrorMessage(error));
|
|
65
|
-
process.exitCode = 1;
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
//#endregion
|
|
69
|
-
export { run };
|
|
70
|
-
|
|
71
|
-
//# sourceMappingURL=run-BYff_byB.js.map
|
package/dist/run-BYff_byB.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-BYff_byB.js","names":[],"sources":["../src/runners/list/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { getErrorMessage } from '@internals/utils'\nimport { readInstalledPackages, type RegistryEntry } from '@kubb/core'\nimport { logBlock, logError, logOutro, logWarn } from '../../loggers/output.ts'\nimport { fetchRegistryIndex, isOutdated, registryUrl } from '../../utils/registry.ts'\n\nexport type ListRow = {\n id?: string\n package: string\n installed?: string\n registry?: string\n update: boolean\n}\n\n/**\n * The installed packages that ship a `kubb-extension.json` or have a registry entry, with the\n * version the registry pins.\n */\nexport async function listExtensions({ cwd, registry }: { cwd: string; registry: string }): Promise<Array<ListRow>> {\n const [installed, entries] = await Promise.all([\n readInstalledPackages({ root: cwd }),\n fetchRegistryIndex({ registry }).catch((error: unknown): Array<RegistryEntry> => {\n logWarn(`Showing installed extensions only: ${getErrorMessage(error)}`)\n return []\n }),\n ])\n const byPackage = new Map(entries.map((entry) => [entry.artifact.package, entry]))\n\n return installed.flatMap(({ package: name, version, manifest }): Array<ListRow> => {\n const entry = byPackage.get(name)\n if (!entry && !manifest) return []\n const latest = entry?.artifact.version\n return [{ id: entry?.id, package: name, installed: version, registry: latest, update: !!latest && isOutdated({ installed: version, latest }) }]\n })\n}\n\n/** Prints the installed extensions as a table. */\nexport async function run(): Promise<void> {\n try {\n const rows = await listExtensions({ cwd: process.cwd(), registry: registryUrl() })\n if (!rows.length) {\n logOutro('No installed extensions found.')\n return\n }\n\n const header = ['ID', 'PACKAGE', 'INSTALLED', 'REGISTRY', 'UPDATE']\n const cells = rows.map((row) => [row.id ?? '-', row.package, row.installed ?? '-', row.registry ?? '-', row.update ? 'yes' : 'no'])\n const widths = header.map((title, index) => Math.max(title.length, ...cells.map((cell) => cell[index]!.length)))\n const line = (cell: Array<string>) =>\n cell\n .map((value, index) => value.padEnd(widths[index]!))\n .join(' ')\n .trimEnd()\n\n logBlock([styleText('dim', line(header)), ...cells.map(line)])\n } catch (error) {\n logError(getErrorMessage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M,CAAE,MAAM,CAAC,CAAC;EAC/G,MAAM,QAAQ,SACZ,KACG,KAAK,OAAO,UAAU,MAAM,OAAO,OAAO,MAAO,CAAC,CAAC,CACnD,KAAK,IAAI,CAAC,CACV,QAAQ;EAEb,SAAS,CAAC,UAAU,OAAO,KAAK,MAAM,CAAC,GAAG,GAAG,MAAM,IAAI,IAAI,CAAC,CAAC;CAC/D,SAAS,OAAO;EACd,SAAS,gBAAgB,KAAK,CAAC;EAC/B,QAAQ,WAAW;CACrB;AACF"}
|
package/dist/run-Bhs7mJ1f.cjs
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
const require_agent = require("./agent-DElUuYuy.cjs");
|
|
2
|
-
const require_errors = require("./errors-BdA8M78q.cjs");
|
|
3
|
-
const require_output = require("./output-BnK0scpX.cjs");
|
|
4
|
-
const require_registry = require("./registry-DER9aRyg.cjs");
|
|
5
|
-
const require_utils = require("./utils-BzQ46pgd.cjs");
|
|
6
|
-
let node_util = require("node:util");
|
|
7
|
-
let node_process = require("node:process");
|
|
8
|
-
node_process = require_agent.__toESM(node_process, 1);
|
|
9
|
-
let _clack_prompts = require("@clack/prompts");
|
|
10
|
-
_clack_prompts = require_agent.__toESM(_clack_prompts, 1);
|
|
11
|
-
let _kubb_core = require("@kubb/core");
|
|
12
|
-
//#region src/runners/update/run.ts
|
|
13
|
-
/**
|
|
14
|
-
* Moves installed extensions to the version the registry pins. Lists the proposals, asks, then
|
|
15
|
-
* installs them. With `check`, only lists them.
|
|
16
|
-
*/
|
|
17
|
-
async function run({ ids, check, yes }) {
|
|
18
|
-
const cwd = node_process.default.cwd();
|
|
19
|
-
require_output.logIntro({ title: (0, node_util.styleText)("bgCyan", (0, node_util.styleText)("black", " Kubb Update ")) });
|
|
20
|
-
try {
|
|
21
|
-
const wanted = new Set(ids.map(require_registry.toRegistryId));
|
|
22
|
-
const [entries, installed] = await Promise.all([require_registry.fetchRegistryIndex({ registry: require_registry.registryUrl() }), (0, _kubb_core.readInstalledPackages)({ root: cwd })]);
|
|
23
|
-
const versions = new Map(installed.map((item) => [item.package, item.version]));
|
|
24
|
-
const tracked = entries.filter((entry) => versions.has(entry.artifact.package) && (!wanted.size || wanted.has(entry.id)));
|
|
25
|
-
for (const id of wanted) if (!tracked.some((entry) => entry.id === id)) require_output.logWarn(`${id} is not installed, or not in the registry.`);
|
|
26
|
-
const proposals = tracked.filter((entry) => {
|
|
27
|
-
if (!require_registry.isOutdated({
|
|
28
|
-
installed: versions.get(entry.artifact.package),
|
|
29
|
-
latest: entry.artifact.version
|
|
30
|
-
})) return false;
|
|
31
|
-
const problem = require_registry.incompatibility(entry.manifest);
|
|
32
|
-
if (problem) require_output.logWarn(`Skipped ${entry.id}: ${problem}`);
|
|
33
|
-
return !problem;
|
|
34
|
-
});
|
|
35
|
-
if (!proposals.length) {
|
|
36
|
-
require_output.logOutro(ids.length ? `No updates for ${ids.join(", ")}.` : "Every installed extension is up to date.");
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
const change = ({ kind, artifact }) => `${kind} ${versions.get(artifact.package) ?? "not installed"} -> ${(0, node_util.styleText)("green", artifact.version)}`;
|
|
40
|
-
require_output.logBlock(proposals.map((entry) => `${entry.artifact.package} ${change(entry)}`));
|
|
41
|
-
if (check) {
|
|
42
|
-
const plural = proposals.length === 1 ? "" : "s";
|
|
43
|
-
require_output.logOutro(`${proposals.length} update${plural} available. Run \`kubb update\` to install.`);
|
|
44
|
-
return;
|
|
45
|
-
}
|
|
46
|
-
let selected = proposals;
|
|
47
|
-
if (!yes) {
|
|
48
|
-
const chosen = await _clack_prompts.multiselect({
|
|
49
|
-
message: "Select the updates to install:",
|
|
50
|
-
options: proposals.map((entry) => ({
|
|
51
|
-
value: entry.id,
|
|
52
|
-
label: entry.artifact.package,
|
|
53
|
-
hint: change(entry)
|
|
54
|
-
})),
|
|
55
|
-
initialValues: proposals.map((entry) => entry.id),
|
|
56
|
-
required: true
|
|
57
|
-
});
|
|
58
|
-
if (_clack_prompts.isCancel(chosen)) {
|
|
59
|
-
_clack_prompts.cancel("Operation canceled.");
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
selected = proposals.filter((entry) => chosen.includes(entry.id));
|
|
63
|
-
}
|
|
64
|
-
const plural = selected.length === 1 ? "" : "s";
|
|
65
|
-
const packageManager = require_utils.detectPackageManager(cwd);
|
|
66
|
-
const specs = selected.map(({ artifact }) => require_registry.installSpec(artifact));
|
|
67
|
-
require_output.logStep(`Installing ${specs.join(", ")} with ${packageManager.name}`);
|
|
68
|
-
await require_utils.installPackages(specs, packageManager, cwd);
|
|
69
|
-
require_output.logInfo(`Updated ${specs.length} extension${plural}`);
|
|
70
|
-
require_output.logOutro((0, node_util.styleText)("green", "Done"));
|
|
71
|
-
} catch (error) {
|
|
72
|
-
require_output.logError(require_errors.getErrorMessage(error));
|
|
73
|
-
node_process.default.exitCode = 1;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
//#endregion
|
|
77
|
-
exports.run = run;
|
|
78
|
-
|
|
79
|
-
//# sourceMappingURL=run-Bhs7mJ1f.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-Bhs7mJ1f.cjs","names":["process","styleText","toRegistryId","fetchRegistryIndex","registryUrl","readInstalledPackages","isOutdated","incompatibility","clack","detectPackageManager","installSpec","installPackages","getErrorMessage"],"sources":["../src/runners/update/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { getErrorMessage } from '@internals/utils'\nimport { readInstalledPackages, type RegistryEntry } from '@kubb/core'\nimport { logBlock, logError, logInfo, logIntro, logOutro, logStep, logWarn } from '../../loggers/output.ts'\nimport { fetchRegistryIndex, incompatibility, installSpec, isOutdated, registryUrl, toRegistryId } from '../../utils/registry.ts'\nimport { detectPackageManager, installPackages } from '../init/utils.ts'\n\nexport type UpdateOptions = {\n /**\n * Registry ids to update. Empty updates every installed extension the registry lists.\n */\n ids: Array<string>\n check: boolean\n yes: boolean\n}\n\n/**\n * Moves installed extensions to the version the registry pins. Lists the proposals, asks, then\n * installs them. With `check`, only lists them.\n */\nexport async function run({ ids, check, yes }: UpdateOptions): Promise<void> {\n const cwd = process.cwd()\n logIntro({ title: styleText('bgCyan', styleText('black', ' Kubb Update ')) })\n\n try {\n const wanted = new Set(ids.map(toRegistryId))\n const [entries, installed] = await Promise.all([fetchRegistryIndex({ registry: registryUrl() }), readInstalledPackages({ root: cwd })])\n const versions = new Map(installed.map((item) => [item.package, item.version]))\n\n const tracked = entries.filter((entry) => versions.has(entry.artifact.package) && (!wanted.size || wanted.has(entry.id)))\n for (const id of wanted) {\n if (!tracked.some((entry) => entry.id === id)) logWarn(`${id} is not installed, or not in the registry.`)\n }\n\n const proposals = tracked.filter((entry) => {\n if (!isOutdated({ installed: versions.get(entry.artifact.package), latest: entry.artifact.version })) return false\n const problem = incompatibility(entry.manifest)\n if (problem) logWarn(`Skipped ${entry.id}: ${problem}`)\n return !problem\n })\n\n if (!proposals.length) {\n logOutro(ids.length ? `No updates for ${ids.join(', ')}.` : 'Every installed extension is up to date.')\n return\n }\n\n const change = ({ kind, artifact }: RegistryEntry) =>\n `${kind} ${versions.get(artifact.package) ?? 'not installed'} -> ${styleText('green', artifact.version)}`\n logBlock(proposals.map((entry) => `${entry.artifact.package} ${change(entry)}`))\n\n if (check) {\n const plural = proposals.length === 1 ? '' : 's'\n logOutro(`${proposals.length} update${plural} available. Run \\`kubb update\\` to install.`)\n return\n }\n\n let selected = proposals\n if (!yes) {\n const chosen = await clack.multiselect({\n message: 'Select the updates to install:',\n options: proposals.map((entry) => ({ value: entry.id, label: entry.artifact.package, hint: change(entry) })),\n initialValues: proposals.map((entry) => entry.id),\n required: true,\n })\n if (clack.isCancel(chosen)) {\n clack.cancel('Operation canceled.')\n return\n }\n selected = proposals.filter((entry) => chosen.includes(entry.id))\n }\n\n const plural = selected.length === 1 ? '' : 's'\n const packageManager = detectPackageManager(cwd)\n const specs = selected.map(({ artifact }) => installSpec(artifact))\n logStep(`Installing ${specs.join(', ')} with ${packageManager.name}`)\n await installPackages(specs, packageManager, cwd)\n\n logInfo(`Updated ${specs.length} extension${plural}`)\n logOutro(styleText('green', 'Done'))\n } catch (error) {\n logError(getErrorMessage(error))\n process.exitCode = 1\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,eAAsB,IAAI,EAAE,KAAK,OAAO,OAAqC;CAC3E,MAAM,MAAMA,aAAAA,QAAQ,IAAI;CACxB,eAAA,SAAS,EAAE,QAAA,GAAOC,UAAAA,UAAAA,CAAU,WAAA,GAAUA,UAAAA,UAAAA,CAAU,SAAS,eAAe,CAAC,EAAE,CAAC;CAE5E,IAAI;EACF,MAAM,SAAS,IAAI,IAAI,IAAI,IAAIC,iBAAAA,YAAY,CAAC;EAC5C,MAAM,CAAC,SAAS,aAAa,MAAM,QAAQ,IAAI,CAACC,iBAAAA,mBAAmB,EAAE,UAAUC,iBAAAA,YAAY,EAAE,CAAC,IAAA,GAAGC,WAAAA,sBAAAA,CAAsB,EAAE,MAAM,IAAI,CAAC,CAAC,CAAC;EACtI,MAAM,WAAW,IAAI,IAAI,UAAU,KAAK,SAAS,CAAC,KAAK,SAAS,KAAK,OAAO,CAAC,CAAC;EAE9E,MAAM,UAAU,QAAQ,QAAQ,UAAU,SAAS,IAAI,MAAM,SAAS,OAAO,MAAM,CAAC,OAAO,QAAQ,OAAO,IAAI,MAAM,EAAE,EAAE;EACxH,KAAK,MAAM,MAAM,QACf,IAAI,CAAC,QAAQ,MAAM,UAAU,MAAM,OAAO,EAAE,GAAG,eAAA,QAAQ,GAAG,GAAG,2CAA2C;EAG1G,MAAM,YAAY,QAAQ,QAAQ,UAAU;GAC1C,IAAI,CAACC,iBAAAA,WAAW;IAAE,WAAW,SAAS,IAAI,MAAM,SAAS,OAAO;IAAG,QAAQ,MAAM,SAAS;GAAQ,CAAC,GAAG,OAAO;GAC7G,MAAM,UAAUC,iBAAAA,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E,MAAMC,cAAAA,gBAAgB,OAAO,gBAAgB,GAAG;EAEhD,eAAA,QAAQ,WAAW,MAAM,OAAO,YAAY,QAAQ;EACpD,eAAA,UAAA,GAASV,UAAAA,UAAAA,CAAU,SAAS,MAAM,CAAC;CACrC,SAAS,OAAO;EACd,eAAA,SAASW,eAAAA,gBAAgB,KAAK,CAAC;EAC/B,aAAA,QAAA,WAAmB;CACrB;AACF"}
|
package/dist/run-CH48n-MJ.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { n as run } from "./run-DfEoWJuy.js";
|
package/dist/run-DfEoWJuy.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import "./rolldown-runtime-CRm0XQPb.js";
|
|
2
|
-
import { t as getErrorMessage } from "./errors-DmC83ALX.js";
|
|
3
|
-
import { t as findConfigFile } from "./config-B6UIKcl1.js";
|
|
4
|
-
import { a as logInfo, d as logWarn, i as logError, l as logStep, o as logIntro, r as logBlock, s as logOutro } from "./output-qFt4vV7K.js";
|
|
5
|
-
import { i as installSpec, n as fetchRegistryIndex, o as registryUrl, r as incompatibility, s as toRegistryId, t as fetchRegistryDetail } from "./registry-B7BvdrGE.js";
|
|
6
|
-
import { r as installPackages, t as detectPackageManager } from "./utils-BHW8kA8P.js";
|
|
7
|
-
import { styleText } from "node:util";
|
|
8
|
-
import process from "node:process";
|
|
9
|
-
import path from "node:path";
|
|
10
|
-
import * as clack from "@clack/prompts";
|
|
11
|
-
//#region src/runners/add/run.ts
|
|
12
|
-
/** The import and the `defineConfig` property to merge into `kubb.config.ts` by hand. */
|
|
13
|
-
function toSnippet({ artifact, manifest }) {
|
|
14
|
-
const call = `${manifest.export}()`;
|
|
15
|
-
const property = {
|
|
16
|
-
plugin: `plugins: [..., ${call}],`,
|
|
17
|
-
adapter: `adapter: ${call},`,
|
|
18
|
-
parser: `parsers: [..., ${call}],`
|
|
19
|
-
};
|
|
20
|
-
return [
|
|
21
|
-
`import { ${manifest.export} } from '${artifact.package}'`,
|
|
22
|
-
"",
|
|
23
|
-
property[manifest.kind]
|
|
24
|
-
].join("\n");
|
|
25
|
-
}
|
|
26
|
-
/** Adds the plugin call and its import to the config file. Returns why it could not, or `undefined`. */
|
|
27
|
-
async function addToConfig({ detail, configFile }) {
|
|
28
|
-
const { artifact, manifest } = detail;
|
|
29
|
-
try {
|
|
30
|
-
const { writeConfigEdits } = await import("@kubb/studio");
|
|
31
|
-
const { outcomes } = await writeConfigEdits({
|
|
32
|
-
filePath: configFile,
|
|
33
|
-
edits: [{
|
|
34
|
-
operation: "add-plugin",
|
|
35
|
-
plugin: artifact.package
|
|
36
|
-
}],
|
|
37
|
-
extensions: /* @__PURE__ */ new Map([[artifact.package, {
|
|
38
|
-
package: artifact.package,
|
|
39
|
-
version: artifact.version,
|
|
40
|
-
manifest
|
|
41
|
-
}]])
|
|
42
|
-
});
|
|
43
|
-
return outcomes[0]?.applied ? void 0 : outcomes[0]?.reason ?? "the config file was not changed";
|
|
44
|
-
} catch (error) {
|
|
45
|
-
return getErrorMessage(error);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
async function selectExtension(registry) {
|
|
49
|
-
const options = (await fetchRegistryIndex({ registry })).toSorted((a, b) => a.id.localeCompare(b.id)).map((entry) => ({
|
|
50
|
-
value: entry.id,
|
|
51
|
-
label: entry.manifest.displayName,
|
|
52
|
-
hint: `${entry.id} · ${entry.kind} ${entry.artifact.version} · ${entry.manifest.description}`
|
|
53
|
-
}));
|
|
54
|
-
if (!options.length) throw new Error(`The registry at ${registry} lists no extensions.`);
|
|
55
|
-
const id = await clack.autocomplete({
|
|
56
|
-
message: "Select an extension to add:",
|
|
57
|
-
options,
|
|
58
|
-
filter: (search, option) => `${option.label} ${option.hint}`.toLowerCase().includes(search.toLowerCase())
|
|
59
|
-
});
|
|
60
|
-
return clack.isCancel(id) ? void 0 : id;
|
|
61
|
-
}
|
|
62
|
-
/**
|
|
63
|
-
* Installs an extension from the Kubb registry at its reviewed version and, for a plugin, adds it to
|
|
64
|
-
* `kubb.config.ts`. Without an id, asks which one. Refuses when the running Kubb or Node.js version
|
|
65
|
-
* is outside its compatibility.
|
|
66
|
-
*/
|
|
67
|
-
async function run({ id: input, configPath, yes, install }) {
|
|
68
|
-
const cwd = process.cwd();
|
|
69
|
-
logIntro({ title: styleText("bgCyan", styleText("black", " Kubb Add ")) });
|
|
70
|
-
try {
|
|
71
|
-
const registry = registryUrl();
|
|
72
|
-
if (!input && yes) throw new Error("Pass a registry id, such as plugin-zod, when using --yes.");
|
|
73
|
-
const id = input ? toRegistryId(input) : await selectExtension(registry);
|
|
74
|
-
if (!id) {
|
|
75
|
-
clack.cancel("Operation canceled.");
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
const detail = await fetchRegistryDetail({
|
|
79
|
-
id,
|
|
80
|
-
registry
|
|
81
|
-
});
|
|
82
|
-
const { artifact, manifest } = detail;
|
|
83
|
-
const problem = incompatibility(manifest);
|
|
84
|
-
if (problem) throw new Error(problem);
|
|
85
|
-
const spec = installSpec(artifact);
|
|
86
|
-
const configFile = manifest.kind === "plugin" ? configPath ? path.resolve(configPath) : findConfigFile(cwd) : void 0;
|
|
87
|
-
if (manifest.kind === "plugin" && !configFile) throw new Error("No kubb.config.ts found. Run `kubb init` first, or pass --config.");
|
|
88
|
-
logInfo(`${styleText("cyan", manifest.displayName)} (${manifest.kind}): ${manifest.description}`);
|
|
89
|
-
logBlock([install ? `Install ${styleText("cyan", spec)} as a dev dependency` : `Skip installing ${spec}`, configFile ? `Add ${styleText("cyan", `${manifest.export}()`)} to ${path.relative(cwd, configFile) || configFile}` : `Print the ${manifest.kind} snippet to add`]);
|
|
90
|
-
const confirmed = yes || await clack.confirm({
|
|
91
|
-
message: "Continue?",
|
|
92
|
-
initialValue: true
|
|
93
|
-
});
|
|
94
|
-
if (clack.isCancel(confirmed) || !confirmed) {
|
|
95
|
-
clack.cancel("Operation canceled.");
|
|
96
|
-
return;
|
|
97
|
-
}
|
|
98
|
-
if (install) {
|
|
99
|
-
const packageManager = detectPackageManager(cwd);
|
|
100
|
-
logStep(`Installing ${spec} with ${packageManager.name}`);
|
|
101
|
-
await installPackages([spec], packageManager, cwd);
|
|
102
|
-
}
|
|
103
|
-
const reason = configFile ? await addToConfig({
|
|
104
|
-
detail,
|
|
105
|
-
configFile
|
|
106
|
-
}) : `add the ${manifest.kind} to your config`;
|
|
107
|
-
if (!reason) {
|
|
108
|
-
logOutro(styleText("green", install ? `Added ${spec}` : `Added ${manifest.export}() to the config. Install ${spec} to use it.`));
|
|
109
|
-
return;
|
|
110
|
-
}
|
|
111
|
-
if (configFile) logWarn(`Could not edit ${configFile}: ${reason}`);
|
|
112
|
-
logBlock([
|
|
113
|
-
"Add the import to your Kubb config and merge the property into its defineConfig call:",
|
|
114
|
-
"",
|
|
115
|
-
toSnippet(detail)
|
|
116
|
-
]);
|
|
117
|
-
logOutro(styleText("green", install ? `Installed ${spec}. Add it with the snippet above.` : `Install ${spec} and add the snippet above.`));
|
|
118
|
-
} catch (error) {
|
|
119
|
-
logError(getErrorMessage(error));
|
|
120
|
-
process.exitCode = 1;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
//#endregion
|
|
124
|
-
export { run as n, toSnippet as r, addToConfig as t };
|
|
125
|
-
|
|
126
|
-
//# sourceMappingURL=run-DfEoWJuy.js.map
|
package/dist/run-DfEoWJuy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-DfEoWJuy.js","names":[],"sources":["../src/runners/add/run.ts"],"sourcesContent":["import path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport { getErrorMessage } from '@internals/utils'\nimport type { ExtensionManifest, RegistryDetail } from '@kubb/core'\nimport { findConfigFile } from '../../config.ts'\nimport { logBlock, logError, logInfo, logIntro, logOutro, logStep, logWarn } from '../../loggers/output.ts'\nimport { fetchRegistryDetail, fetchRegistryIndex, incompatibility, installSpec, registryUrl, toRegistryId } from '../../utils/registry.ts'\nimport { detectPackageManager, installPackages } from '../init/utils.ts'\n\nexport type AddOptions = {\n /**\n * `owner/slug`, or a bare `slug` for an official extension. Asked for when omitted.\n */\n id?: string\n configPath?: string\n yes: boolean\n install: boolean\n}\n\n/** The import and the `defineConfig` property to merge into `kubb.config.ts` by hand. */\nexport function toSnippet({ artifact, manifest }: Pick<RegistryDetail, 'artifact' | 'manifest'>): string {\n const call = `${manifest.export}()`\n const property: Record<ExtensionManifest['kind'], string> = {\n plugin: `plugins: [..., ${call}],`,\n adapter: `adapter: ${call},`,\n parser: `parsers: [..., ${call}],`,\n }\n return [`import { ${manifest.export} } from '${artifact.package}'`, '', property[manifest.kind]].join('\\n')\n}\n\n/** Adds the plugin call and its import to the config file. Returns why it could not, or `undefined`. */\nexport async function addToConfig({\n detail,\n configFile,\n}: {\n detail: Pick<RegistryDetail, 'artifact' | 'manifest'>\n configFile: string\n}): Promise<string | undefined> {\n const { artifact, manifest } = detail\n try {\n const { writeConfigEdits } = await import('@kubb/studio')\n const { outcomes } = await writeConfigEdits({\n filePath: configFile,\n edits: [{ operation: 'add-plugin', plugin: artifact.package }],\n extensions: new Map([[artifact.package, { package: artifact.package, version: artifact.version, manifest }]]),\n })\n return outcomes[0]?.applied ? undefined : (outcomes[0]?.reason ?? 'the config file was not changed')\n } catch (error) {\n return getErrorMessage(error)\n }\n}\n\nasync function selectExtension(registry: string): Promise<string | undefined> {\n const entries = await fetchRegistryIndex({ registry })\n const options = entries\n .toSorted((a, b) => a.id.localeCompare(b.id))\n .map((entry) => ({\n value: entry.id,\n label: entry.manifest.displayName,\n hint: `${entry.id} · ${entry.kind} ${entry.artifact.version} · ${entry.manifest.description}`,\n }))\n if (!options.length) throw new Error(`The registry at ${registry} lists no extensions.`)\n\n const id = await clack.autocomplete({\n message: 'Select an extension to add:',\n options,\n filter: (search, option) => `${option.label} ${option.hint}`.toLowerCase().includes(search.toLowerCase()),\n })\n return clack.isCancel(id) ? undefined : id\n}\n\n/**\n * Installs an extension from the Kubb registry at its reviewed version and, for a plugin, adds it to\n * `kubb.config.ts`. Without an id, asks which one. Refuses when the running Kubb or Node.js version\n * is outside its compatibility.\n */\nexport async function run({ id: input, configPath, yes, install }: AddOptions): Promise<void> {\n const cwd = process.cwd()\n logIntro({ title: styleText('bgCyan', styleText('black', ' Kubb Add ')) })\n\n try {\n const registry = registryUrl()\n if (!input && yes) throw new Error('Pass a registry id, such as plugin-zod, when using --yes.')\n const id = input ? toRegistryId(input) : await selectExtension(registry)\n if (!id) {\n clack.cancel('Operation canceled.')\n return\n }\n const detail = await fetchRegistryDetail({ id, registry })\n const { artifact, manifest } = detail\n\n const problem = incompatibility(manifest)\n if (problem) throw new Error(problem)\n\n const spec = installSpec(artifact)\n const configFile = manifest.kind === 'plugin' ? (configPath ? path.resolve(configPath) : findConfigFile(cwd)) : undefined\n if (manifest.kind === 'plugin' && !configFile) throw new Error('No kubb.config.ts found. Run `kubb init` first, or pass --config.')\n\n logInfo(`${styleText('cyan', manifest.displayName)} (${manifest.kind}): ${manifest.description}`)\n logBlock([\n install ? `Install ${styleText('cyan', spec)} as a dev dependency` : `Skip installing ${spec}`,\n configFile\n ? `Add ${styleText('cyan', `${manifest.export}()`)} to ${path.relative(cwd, configFile) || configFile}`\n : `Print the ${manifest.kind} snippet to add`,\n ])\n\n const confirmed = yes || (await clack.confirm({ message: 'Continue?', initialValue: true }))\n if (clack.isCancel(confirmed) || !confirmed) {\n clack.cancel('Operation canceled.')\n return\n }\n\n if (install) {\n const packageManager = detectPackageManager(cwd)\n logStep(`Installing ${spec} with ${packageManager.name}`)\n await installPackages([spec], packageManager, cwd)\n }\n\n const reason = configFile ? await addToConfig({ detail, configFile }) : `add the ${manifest.kind} to your config`\n if (!reason) {\n logOutro(styleText('green', install ? `Added ${spec}` : `Added ${manifest.export}() to the config. Install ${spec} to use it.`))\n return\n }\n\n if (configFile) logWarn(`Could not edit ${configFile}: ${reason}`)\n logBlock(['Add the import to your Kubb config and merge the property into its defineConfig call:', '', toSnippet(detail)])\n logOutro(styleText('green', install ? `Installed ${spec}. Add it with the snippet above.` : `Install ${spec} and add the snippet above.`))\n } catch (error) {\n logError(getErrorMessage(error))\n process.exitCode = 1\n }\n}\n"],"mappings":";;;;;;;;;;;;AAsBA,SAAgB,UAAU,EAAE,UAAU,YAAmE;CACvG,MAAM,OAAO,GAAG,SAAS,OAAO;CAChC,MAAM,WAAsD;EAC1D,QAAQ,kBAAkB,KAAK;EAC/B,SAAS,YAAY,KAAK;EAC1B,QAAQ,kBAAkB,KAAK;CACjC;CACA,OAAO;EAAC,YAAY,SAAS,OAAO,WAAW,SAAS,QAAQ;EAAI;EAAI,SAAS,SAAS;CAAK,CAAC,CAAC,KAAK,IAAI;AAC5G;;AAGA,eAAsB,YAAY,EAChC,QACA,cAI8B;CAC9B,MAAM,EAAE,UAAU,aAAa;CAC/B,IAAI;EACF,MAAM,EAAE,qBAAqB,MAAM,OAAO;EAC1C,MAAM,EAAE,aAAa,MAAM,iBAAiB;GAC1C,UAAU;GACV,OAAO,CAAC;IAAE,WAAW;IAAc,QAAQ,SAAS;GAAQ,CAAC;GAC7D,4BAAY,IAAI,IAAI,CAAC,CAAC,SAAS,SAAS;IAAE,SAAS,SAAS;IAAS,SAAS,SAAS;IAAS;GAAS,CAAC,CAAC,CAAC;EAC9G,CAAC;EACD,OAAO,SAAS,EAAE,EAAE,UAAU,KAAA,IAAa,SAAS,EAAE,EAAE,UAAU;CACpE,SAAS,OAAO;EACd,OAAO,gBAAgB,KAAK;CAC9B;AACF;AAEA,eAAe,gBAAgB,UAA+C;CAE5E,MAAM,WAAU,MADM,mBAAmB,EAAE,SAAS,CAAC,EAAA,CAElD,UAAU,GAAG,MAAM,EAAE,GAAG,cAAc,EAAE,EAAE,CAAC,CAAC,CAC5C,KAAK,WAAW;EACf,OAAO,MAAM;EACb,OAAO,MAAM,SAAS;EACtB,MAAM,GAAG,MAAM,GAAG,KAAK,MAAM,KAAK,G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E,wBAAwB,mBAAmB,QACxF,aACI,OAAO,UAAU,QAAQ,GAAG,SAAS,OAAO,GAAG,EAAE,MAAM,KAAK,SAAS,KAAK,UAAU,KAAK,eACzF,aAAa,SAAS,KAAK,gBACjC,CAAC;EAED,MAAM,YAAY,OAAQ,MAAM,MAAM,QAAQ;GAAE,SAAS;GAAa,cAAc;EAAK,CAAC;EAC1F,IAAI,MAAM,SAAS,SAAS,KAAK,CAAC,WAAW;GAC3C,MAAM,OAAO,qBAAqB;GAClC;EACF;EAEA,IAAI,SAAS;GACX,MAAM,iBAAiB,qBAAqB,GAAG;GAC/C,QAAQ,cAAc,KAAK,QAAQ,eAAe,MAAM;GACxD,MAAM,gBAAgB,CAAC,IAAI,GAAG,gBAAgB,GAAG;EACnD;EAEA,MAAM,SAAS,aAAa,MAAM,YAAY;GAAE;GAAQ;EAAW,CAAC,IAAI,WAAW,SAAS,KAAK;EACjG,IAAI,CAAC,QAAQ;GACX,SAAS,UAAU,SAAS,UAAU,SAAS,SAAS,SAAS,SAAS,OAAO,4BAA4B,KAAK,YAAY,CAAC;GAC/H;EACF;EAEA,IAAI,YAAY,QAAQ,kBAAkB,WAAW,IAAI,QAAQ;EACjE,SAAS;GAAC;GAAyF;GAAI,UAAU,MAAM;EAAC,CAAC;EACzH,SAAS,UAAU,SAAS,UAAU,aAAa,KAAK,oCAAoC,WAAW,KAAK,4BAA4B,CAAC;CAC3I,SAAS,OAAO;EACd,SAAS,gBAAgB,KAAK,CAAC;EAC/B,QAAQ,WAAW;CACrB;AACF"}
|
package/dist/run-Dm9OZUkQ.cjs
DELETED
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
const require_agent = require("./agent-DElUuYuy.cjs");
|
|
2
|
-
const require_constants = require("./constants-Df449N47.cjs");
|
|
3
|
-
const require_output = require("./output-BnK0scpX.cjs");
|
|
4
|
-
const require_registry = require("./registry-DER9aRyg.cjs");
|
|
5
|
-
const require_utils = require("./utils-BzQ46pgd.cjs");
|
|
6
|
-
const require_run = require("./run-BGTUbY2h.cjs");
|
|
7
|
-
let node_util = require("node:util");
|
|
8
|
-
let node_process = require("node:process");
|
|
9
|
-
node_process = require_agent.__toESM(node_process, 1);
|
|
10
|
-
let node_path = require("node:path");
|
|
11
|
-
node_path = require_agent.__toESM(node_path, 1);
|
|
12
|
-
let _clack_prompts = require("@clack/prompts");
|
|
13
|
-
_clack_prompts = require_agent.__toESM(_clack_prompts, 1);
|
|
14
|
-
let node_fs = require("node:fs");
|
|
15
|
-
node_fs = require_agent.__toESM(node_fs, 1);
|
|
16
|
-
//#region ../../internals/shared/src/init.ts
|
|
17
|
-
function generateConfigFile({ selectedPlugins, inputPath, outputPath }) {
|
|
18
|
-
return `${[`import { defineConfig } from 'kubb/config'`, ...selectedPlugins.map((plugin) => `import { ${plugin.importName} } from '${plugin.packageName}'`)].join("\n")}
|
|
19
|
-
|
|
20
|
-
export default defineConfig({
|
|
21
|
-
input: '${inputPath}',
|
|
22
|
-
output: {
|
|
23
|
-
path: '${outputPath}',
|
|
24
|
-
clean: true,
|
|
25
|
-
},
|
|
26
|
-
plugins: [
|
|
27
|
-
${selectedPlugins.map((plugin) => ` ${plugin.importName}(),`).join("\n")}
|
|
28
|
-
],
|
|
29
|
-
})
|
|
30
|
-
`;
|
|
31
|
-
}
|
|
32
|
-
//#endregion
|
|
33
|
-
//#region src/runners/init/run.ts
|
|
34
|
-
function cancelAndExit(message = "Operation canceled.") {
|
|
35
|
-
_clack_prompts.cancel(message);
|
|
36
|
-
node_process.default.exit(0);
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Runs the interactive Kubb scaffolding wizard.
|
|
40
|
-
* Detects the package manager, prompts for input/output paths and plugins, installs packages, and writes `kubb.config.ts`.
|
|
41
|
-
* Pass `yes: true` to skip all prompts and use defaults.
|
|
42
|
-
*/
|
|
43
|
-
async function run({ yes, version, input: inputFlag, output: outputFlag, plugins: pluginsFlag, dryRun }) {
|
|
44
|
-
const cwd = node_process.default.cwd();
|
|
45
|
-
require_output.logIntro({ title: (0, node_util.styleText)("bgCyan", (0, node_util.styleText)("black", " Kubb Init ")) });
|
|
46
|
-
/**
|
|
47
|
-
* Returns `flag` when provided, the `defaultValue` when `yes` is set,
|
|
48
|
-
* or calls `prompt()` for interactive input. Exits on cancellation.
|
|
49
|
-
*/
|
|
50
|
-
async function resolveOrPrompt(flag, defaultValue, logLabel, prompt) {
|
|
51
|
-
if (flag !== void 0) {
|
|
52
|
-
require_output.logInfo(`${logLabel}: ${(0, node_util.styleText)("cyan", String(flag))}`);
|
|
53
|
-
return flag;
|
|
54
|
-
}
|
|
55
|
-
if (yes) {
|
|
56
|
-
require_output.logInfo(`${logLabel}: ${(0, node_util.styleText)("cyan", String(defaultValue))}`);
|
|
57
|
-
return defaultValue;
|
|
58
|
-
}
|
|
59
|
-
const result = await prompt();
|
|
60
|
-
if (_clack_prompts.isCancel(result)) cancelAndExit();
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
try {
|
|
64
|
-
const plugins = (await require_registry.fetchRegistryIndex({ registry: require_registry.registryUrl() })).filter((entry) => entry.kind === "plugin" && !require_registry.incompatibility(entry.manifest));
|
|
65
|
-
const byId = new Map(plugins.map((entry) => [entry.id, entry]));
|
|
66
|
-
if (!node_fs.default.existsSync(node_path.default.join(cwd, "package.json"))) {
|
|
67
|
-
if (!yes) {
|
|
68
|
-
const shouldInit = await _clack_prompts.confirm({
|
|
69
|
-
message: "No package.json found. Would you like to create one?",
|
|
70
|
-
initialValue: true
|
|
71
|
-
});
|
|
72
|
-
if (_clack_prompts.isCancel(shouldInit) || !shouldInit) cancelAndExit();
|
|
73
|
-
}
|
|
74
|
-
const packageManager = require_utils.detectPackageManager(cwd);
|
|
75
|
-
const spinner = require_output.createSpinner();
|
|
76
|
-
spinner.start(`Initializing package.json with ${packageManager.name}`);
|
|
77
|
-
await require_utils.initPackageJson(cwd, packageManager);
|
|
78
|
-
spinner.stop(`Created package.json with ${packageManager.name}`);
|
|
79
|
-
}
|
|
80
|
-
const packageManager = require_utils.detectPackageManager(cwd);
|
|
81
|
-
require_output.logInfo(`Detected package manager: ${(0, node_util.styleText)("cyan", packageManager.name)}`);
|
|
82
|
-
const inputPath = await resolveOrPrompt(inputFlag, require_constants.initDefaults.inputPath, "Using input path", () => _clack_prompts.text({
|
|
83
|
-
message: "Where is your OpenAPI specification located?",
|
|
84
|
-
placeholder: require_constants.initDefaults.inputPath,
|
|
85
|
-
defaultValue: require_constants.initDefaults.inputPath,
|
|
86
|
-
validate: (value) => {
|
|
87
|
-
if (!value) return "Input path is required";
|
|
88
|
-
}
|
|
89
|
-
}));
|
|
90
|
-
const outputPath = await resolveOrPrompt(outputFlag, require_constants.initDefaults.outputPath, "Using output path", () => _clack_prompts.text({
|
|
91
|
-
message: "Where should the generated files be output?",
|
|
92
|
-
placeholder: require_constants.initDefaults.outputPath,
|
|
93
|
-
defaultValue: require_constants.initDefaults.outputPath,
|
|
94
|
-
validate: (value) => {
|
|
95
|
-
if (!value) return "Output path is required";
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
const defaultPlugins = require_constants.initDefaults.plugins.flatMap((slug) => byId.get(require_registry.toRegistryId(slug)) ?? []);
|
|
99
|
-
const pluginLabel = (entries) => (0, node_util.styleText)("cyan", entries.map((entry) => entry.manifest.displayName).join(", "));
|
|
100
|
-
const selectedPlugins = await (async () => {
|
|
101
|
-
if (pluginsFlag) {
|
|
102
|
-
const ids = pluginsFlag.split(",").map((id) => id.trim()).filter(Boolean);
|
|
103
|
-
const unknown = ids.filter((id) => !byId.has(require_registry.toRegistryId(id)));
|
|
104
|
-
if (unknown.length) throw new Error(`Not in the Kubb registry: ${unknown.join(", ")}. Browse the plugins at https://kubb.dev/extensions.`);
|
|
105
|
-
const entries = ids.map((id) => byId.get(require_registry.toRegistryId(id)));
|
|
106
|
-
require_output.logInfo(`Using plugins: ${pluginLabel(entries)}`);
|
|
107
|
-
return entries;
|
|
108
|
-
}
|
|
109
|
-
if (yes) {
|
|
110
|
-
require_output.logInfo(`Using plugins: ${pluginLabel(defaultPlugins)}`);
|
|
111
|
-
return defaultPlugins;
|
|
112
|
-
}
|
|
113
|
-
const values = await _clack_prompts.multiselect({
|
|
114
|
-
message: "Select plugins to use:",
|
|
115
|
-
options: plugins.map(({ id, manifest }) => ({
|
|
116
|
-
value: id,
|
|
117
|
-
label: manifest.displayName,
|
|
118
|
-
hint: manifest.category
|
|
119
|
-
})),
|
|
120
|
-
initialValues: defaultPlugins.map((entry) => entry.id),
|
|
121
|
-
required: true
|
|
122
|
-
});
|
|
123
|
-
if (_clack_prompts.isCancel(values)) cancelAndExit();
|
|
124
|
-
return plugins.filter((entry) => values.includes(entry.id));
|
|
125
|
-
})();
|
|
126
|
-
const missing = require_utils.missingPluginDependencies({
|
|
127
|
-
selected: selectedPlugins.map((entry) => entry.manifest.name),
|
|
128
|
-
manifests: selectedPlugins.map((entry) => entry.manifest)
|
|
129
|
-
});
|
|
130
|
-
if (missing.length) throw new Error(`${missing.join("\n")}\nAdd the missing plugins and run kubb init again.`);
|
|
131
|
-
const packagesToInstall = [`${require_constants.KUBB_PACKAGE_NAME}@${version}`, ...selectedPlugins.map((entry) => require_registry.installSpec(entry.artifact))];
|
|
132
|
-
const spinner = require_output.createSpinner();
|
|
133
|
-
spinner.start(`Installing ${packagesToInstall.length} packages with ${packageManager.name}`);
|
|
134
|
-
try {
|
|
135
|
-
await dryRun.run(() => require_utils.installPackages(packagesToInstall, packageManager, cwd), { message: `install ${packagesToInstall.length} packages with ${packageManager.name}` });
|
|
136
|
-
spinner.stop(`Installed ${packagesToInstall.length} packages`);
|
|
137
|
-
} catch (error) {
|
|
138
|
-
spinner.stop("Installation failed");
|
|
139
|
-
throw error;
|
|
140
|
-
}
|
|
141
|
-
const configSpinner = require_output.createSpinner();
|
|
142
|
-
configSpinner.start(`Creating ${require_constants.KUBB_CONFIG_FILENAME}`);
|
|
143
|
-
const configContent = generateConfigFile({
|
|
144
|
-
selectedPlugins: [],
|
|
145
|
-
inputPath,
|
|
146
|
-
outputPath
|
|
147
|
-
});
|
|
148
|
-
const configPath = node_path.default.join(cwd, require_constants.KUBB_CONFIG_FILENAME);
|
|
149
|
-
if (node_fs.default.existsSync(configPath)) {
|
|
150
|
-
configSpinner.stop(`${require_constants.KUBB_CONFIG_FILENAME} already exists`);
|
|
151
|
-
if (!yes) {
|
|
152
|
-
const shouldOverwrite = await _clack_prompts.confirm({
|
|
153
|
-
message: `${require_constants.KUBB_CONFIG_FILENAME} already exists. Overwrite?`,
|
|
154
|
-
initialValue: false
|
|
155
|
-
});
|
|
156
|
-
if (_clack_prompts.isCancel(shouldOverwrite) || !shouldOverwrite) cancelAndExit("Keeping existing configuration. Packages have been installed.");
|
|
157
|
-
}
|
|
158
|
-
configSpinner.start(`Overwriting ${require_constants.KUBB_CONFIG_FILENAME}`);
|
|
159
|
-
}
|
|
160
|
-
await dryRun.run(() => node_fs.default.promises.writeFile(configPath, configContent, "utf-8"), { message: `write ${require_constants.KUBB_CONFIG_FILENAME}` });
|
|
161
|
-
for (const entry of selectedPlugins) {
|
|
162
|
-
const reason = await dryRun.run(() => require_run.addToConfig({
|
|
163
|
-
detail: entry,
|
|
164
|
-
configFile: configPath
|
|
165
|
-
}), {
|
|
166
|
-
message: `add ${entry.manifest.export}() to ${require_constants.KUBB_CONFIG_FILENAME}`,
|
|
167
|
-
resolve: () => void 0
|
|
168
|
-
});
|
|
169
|
-
if (reason) throw new Error(`Could not add ${entry.manifest.export}() to ${require_constants.KUBB_CONFIG_FILENAME}: ${reason}`);
|
|
170
|
-
}
|
|
171
|
-
configSpinner.stop(`Created ${require_constants.KUBB_CONFIG_FILENAME}`);
|
|
172
|
-
require_output.logOutro((0, node_util.styleText)("green", "✓ All set!") + "\n\n" + (0, node_util.styleText)("dim", "Next steps:") + "\n" + (0, node_util.styleText)("cyan", ` 1. Make sure your OpenAPI spec is at: ${inputPath}`) + "\n" + (0, node_util.styleText)("cyan", " 2. Generate code with: npx kubb generate") + "\n" + (0, node_util.styleText)("cyan", ` 3. Find generated files in: ${outputPath}`) + "\n\n" + (0, node_util.styleText)("dim", `Using ${packageManager.name} • Kubb v${version}`));
|
|
173
|
-
} catch (error) {
|
|
174
|
-
require_output.logError((0, node_util.styleText)("red", "An error occurred during initialization"));
|
|
175
|
-
if (error instanceof Error) require_output.logError(error.message);
|
|
176
|
-
node_process.default.exit(1);
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
//#endregion
|
|
180
|
-
exports.run = run;
|
|
181
|
-
|
|
182
|
-
//# sourceMappingURL=run-Dm9OZUkQ.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-Dm9OZUkQ.cjs","names":["process","styleText","clack","fetchRegistryIndex","registryUrl","incompatibility","fs","path","detectPackageManager","createSpinner","initPackageJson","initDefaults","toRegistryId","missingPluginDependencies","KUBB_PACKAGE_NAME","installSpec","installPackages","KUBB_CONFIG_FILENAME","addToConfig"],"sources":["../../../internals/shared/src/init.ts","../src/runners/init/run.ts"],"sourcesContent":["import { availablePlugins, type PluginOption } from './constants.ts'\n\n/**\n * Resolves a comma-separated plugin flag (e.g. `--plugins plugin-ts,plugin-zod`) into the\n * matching known plugin options. Unrecognized names are dropped, and a missing flag yields\n * an empty list.\n */\nexport function resolvePlugins(pluginsFlag: string | undefined): Array<PluginOption> {\n if (!pluginsFlag) {\n return []\n }\n const requested = pluginsFlag\n .split(',')\n .map((value) => value.trim())\n .filter(Boolean)\n return availablePlugins.filter((plugin) => requested.includes(plugin.value))\n}\n\nexport function generateConfigFile({\n selectedPlugins,\n inputPath,\n outputPath,\n}: {\n selectedPlugins: Array<PluginOption>\n inputPath: string\n outputPath: string\n}): string {\n const imports = [\n `import { defineConfig } from 'kubb/config'`,\n ...selectedPlugins.map((plugin) => `import { ${plugin.importName} } from '${plugin.packageName}'`),\n ].join('\\n')\n\n const pluginConfigs = selectedPlugins.map((plugin) => ` ${plugin.importName}(),`).join('\\n')\n\n return `${imports}\n\nexport default defineConfig({\n input: '${inputPath}',\n output: {\n path: '${outputPath}',\n clean: true,\n },\n plugins: [\n${pluginConfigs}\n ],\n})\n`\n}\n","import fs from 'node:fs'\nimport path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport * as clack from '@clack/prompts'\nimport type { DryRunExtension } from '@gunshi/plugin-dryrun'\nimport { generateConfigFile, initDefaults, KUBB_CONFIG_FILENAME, KUBB_PACKAGE_NAME } from '@internals/shared'\nimport type { RegistryEntry } from '@kubb/core'\nimport { createSpinner, logError, logInfo, logIntro, logOutro } from '../../loggers/output.ts'\nimport { addToConfig } from '../add/run.ts'\nimport { fetchRegistryIndex, incompatibility, installSpec, registryUrl, toRegistryId } from '../../utils/registry.ts'\nimport { detectPackageManager, initPackageJson, installPackages, missingPluginDependencies } from './utils.ts'\n\nfunction cancelAndExit(message = 'Operation canceled.'): never {\n clack.cancel(message)\n process.exit(0)\n}\n\ntype InitOptions = {\n /**\n * When `true`, skips all interactive prompts and uses default values.\n */\n yes: boolean\n /**\n * Current `@kubb/cli` version string, shown in the closing outro.\n */\n version: string\n /**\n * Input path flag value from `--input`. When provided, skips the input prompt.\n */\n input?: string\n /**\n * Output directory flag value from `--output`. When provided, skips the output prompt.\n */\n output?: string\n /**\n * Comma-separated plugin list from `--plugins`, e.g. `'plugin-ts,plugin-zod'`. When provided, skips the plugin selection prompt.\n */\n plugins?: string\n /**\n * Dry-run extension from `@gunshi/plugin-dryrun`. When enabled, package installation and the\n * config file write are skipped.\n */\n dryRun: DryRunExtension\n}\n\n/**\n * Runs the interactive Kubb scaffolding wizard.\n * Detects the package manager, prompts for input/output paths and plugins, installs packages, and writes `kubb.config.ts`.\n * Pass `yes: true` to skip all prompts and use defaults.\n */\nexport async function run({ yes, version, input: inputFlag, output: outputFlag, plugins: pluginsFlag, dryRun }: InitOptions): Promise<void> {\n const cwd = process.cwd()\n\n logIntro({ title: styleText('bgCyan', styleText('black', ' Kubb Init ')) })\n\n /**\n * Returns `flag` when provided, the `defaultValue` when `yes` is set,\n * or calls `prompt()` for interactive input. Exits on cancellation.\n */\n async function resolveOrPrompt<T>(flag: T | undefined, defaultValue: T, logLabel: string, prompt: () => Promise<NoInfer<T> | symbol>): Promise<T> {\n if (flag !== undefined) {\n logInfo(`${logLabel}: ${styleText('cyan', String(flag))}`)\n return flag\n }\n if (yes) {\n logInfo(`${logLabel}: ${styleText('cyan', String(defaultValue))}`)\n return defaultValue\n }\n const result = await prompt()\n if (clack.isCancel(result)) cancelAndExit()\n return result as T\n }\n\n try {\n // The plugins come from the Kubb registry, like `kubb add`, so read it before changing anything\n const plugins = (await fetchRegistryIndex({ registry: registryUrl() })).filter((entry) => entry.kind === 'plugin' && !incompatibility(entry.manifest))\n const byId = new Map(plugins.map((entry) => [entry.id, entry]))\n\n // Check/create package.json, detect package manager once after the block\n if (!fs.existsSync(path.join(cwd, 'package.json'))) {\n if (!yes) {\n const shouldInit = await clack.confirm({\n message: 'No package.json found. Would you like to create one?',\n initialValue: true,\n })\n\n if (clack.isCancel(shouldInit) || !shouldInit) {\n cancelAndExit()\n }\n }\n\n const packageManager = detectPackageManager(cwd)\n const spinner = createSpinner()\n spinner.start(`Initializing package.json with ${packageManager.name}`)\n await initPackageJson(cwd, packageManager)\n spinner.stop(`Created package.json with ${packageManager.name}`)\n }\n\n const packageManager = detectPackageManager(cwd)\n logInfo(`Detected package manager: ${styleText('cyan', packageManager.name)}`)\n\n // Prompt for OpenAPI spec path\n const inputPath = await resolveOrPrompt(inputFlag, initDefaults.inputPath, 'Using input path', () =>\n clack.text({\n message: 'Where is your OpenAPI specification located?',\n placeholder: initDefaults.inputPath,\n defaultValue: initDefaults.inputPath,\n validate: (value) => {\n if (!value) return 'Input path is required'\n },\n }),\n )\n\n // Prompt for output directory\n const outputPath = await resolveOrPrompt(outputFlag, initDefaults.outputPath, 'Using output path', () =>\n clack.text({\n message: 'Where should the generated files be output?',\n placeholder: initDefaults.outputPath,\n defaultValue: initDefaults.outputPath,\n validate: (value) => {\n if (!value) return 'Output path is required'\n },\n }),\n )\n\n // Plugin selection\n const defaultPlugins = initDefaults.plugins.flatMap((slug) => byId.get(toRegistryId(slug)) ?? [])\n const pluginLabel = (entries: Array<RegistryEntry>) => styleText('cyan', entries.map((entry) => entry.manifest.displayName).join(', '))\n\n const selectedPlugins: Array<RegistryEntry> = await (async () => {\n if (pluginsFlag) {\n const ids = pluginsFlag\n .split(',')\n .map((id) => id.trim())\n .filter(Boolean)\n const unknown = ids.filter((id) => !byId.has(toRegistryId(id)))\n if (unknown.length) throw new Error(`Not in the Kubb registry: ${unknown.join(', ')}. Browse the plugins at https://kubb.dev/extensions.`)\n const entries = ids.map((id) => byId.get(toRegistryId(id))!)\n logInfo(`Using plugins: ${pluginLabel(entries)}`)\n return entries\n }\n if (yes) {\n logInfo(`Using plugins: ${pluginLabel(defaultPlugins)}`)\n return defaultPlugins\n }\n const values = await clack.multiselect({\n message: 'Select plugins to use:',\n options: plugins.map(({ id, manifest }) => ({ value: id, label: manifest.displayName, hint: manifest.category })),\n initialValues: defaultPlugins.map((entry) => entry.id),\n required: true,\n })\n if (clack.isCancel(values)) cancelAndExit()\n return plugins.filter((entry) => (values as Array<string>).includes(entry.id))\n })()\n\n // Check the selection against the plugins' manifests before installing anything\n const missing = missingPluginDependencies({\n selected: selectedPlugins.map((entry) => entry.manifest.name),\n manifests: selectedPlugins.map((entry) => entry.manifest),\n })\n if (missing.length) {\n throw new Error(`${missing.join('\\n')}\\nAdd the missing plugins and run kubb init again.`)\n }\n\n // Install `kubb` at the running CLI's version and each plugin at the version the registry pins\n const packagesToInstall = [`${KUBB_PACKAGE_NAME}@${version}`, ...selectedPlugins.map((entry) => installSpec(entry.artifact))]\n\n const spinner = createSpinner()\n spinner.start(`Installing ${packagesToInstall.length} packages with ${packageManager.name}`)\n\n try {\n await dryRun.run(() => installPackages(packagesToInstall, packageManager, cwd), {\n message: `install ${packagesToInstall.length} packages with ${packageManager.name}`,\n })\n spinner.stop(`Installed ${packagesToInstall.length} packages`)\n } catch (error) {\n spinner.stop('Installation failed')\n throw error\n }\n\n // Generate config file\n const configSpinner = createSpinner()\n configSpinner.start(`Creating ${KUBB_CONFIG_FILENAME}`)\n\n const configContent = generateConfigFile({ selectedPlugins: [], inputPath, outputPath })\n const configPath = path.join(cwd, KUBB_CONFIG_FILENAME)\n\n if (fs.existsSync(configPath)) {\n configSpinner.stop(`${KUBB_CONFIG_FILENAME} already exists`)\n\n if (!yes) {\n const shouldOverwrite = await clack.confirm({\n message: `${KUBB_CONFIG_FILENAME} already exists. Overwrite?`,\n initialValue: false,\n })\n\n if (clack.isCancel(shouldOverwrite) || !shouldOverwrite) {\n cancelAndExit('Keeping existing configuration. Packages have been installed.')\n }\n }\n\n configSpinner.start(`Overwriting ${KUBB_CONFIG_FILENAME}`)\n }\n\n await dryRun.run(() => fs.promises.writeFile(configPath, configContent, 'utf-8'), { message: `write ${KUBB_CONFIG_FILENAME}` })\n\n // Add each plugin the way `kubb add` does\n for (const entry of selectedPlugins) {\n const reason = await dryRun.run(() => addToConfig({ detail: entry, configFile: configPath }), {\n message: `add ${entry.manifest.export}() to ${KUBB_CONFIG_FILENAME}`,\n resolve: () => undefined,\n })\n if (reason) throw new Error(`Could not add ${entry.manifest.export}() to ${KUBB_CONFIG_FILENAME}: ${reason}`)\n }\n\n configSpinner.stop(`Created ${KUBB_CONFIG_FILENAME}`)\n\n logOutro(\n styleText('green', '✓ All set!') +\n '\\n\\n' +\n styleText('dim', 'Next steps:') +\n '\\n' +\n styleText('cyan', ` 1. Make sure your OpenAPI spec is at: ${inputPath}`) +\n '\\n' +\n styleText('cyan', ' 2. Generate code with: npx kubb generate') +\n '\\n' +\n styleText('cyan', ` 3. Find generated files in: ${outputPath}`) +\n '\\n\\n' +\n styleText('dim', `Using ${packageManager.name} • Kubb v${version}`),\n )\n } catch (error) {\n logError(styleText('red', 'An error occurred during initialization'))\n if (error instanceof Error) {\n logError(error.message)\n }\n process.exit(1)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ACnC,MAAM,SAAS,MAAM,OAAO,UAAUC,YAAAA,YAAY;IAAE,QAAQ;IAAO,YAAY;GAAW,CAAC,GAAG;IAC5F,SAAS,OAAO,MAAM,SAAS,OAAO,QAAQD,kBAAAA;IAC9C,eAAe,KAAA;GACjB,CAAC;GACD,IAAI,QAAQ,MAAM,IAAI,MAAM,iBAAiB,MAAM,SAAS,OAAO,QAAQA,kBAAAA,qBAAqB,IAAI,QAAQ;EAC9G;EAEA,cAAc,KAAK,WAAWA,kBAAAA,sBAAsB;EAEpD,eAAA,UAAA,GACEhB,UAAAA,UAAAA,CAAU,SAAS,YAAY,IAC7B,UAAA,GACAA,UAAAA,UAAAA,CAAU,OAAO,aAAa,IAC9B,QAAA,GACAA,UAAAA,UAAAA,CAAU,QAAQ,2CAA2C,WAAW,IACxE,QAAA,GACAA,UAAAA,UAAAA,CAAU,QAAQ,4CAA4C,IAC9D,QAAA,GACAA,UAAAA,UAAAA,CAAU,QAAQ,iCAAiC,YAAY,IAC/D,UAAA,GACAA,UAAAA,UAAAA,CAAU,OAAO,SAAS,eAAe,KAAK,WAAW,SAAS,CACtE;CACF,SAAS,OAAO;EACd,eAAA,UAAA,GAASA,UAAAA,UAAAA,CAAU,OAAO,yCAAyC,CAAC;EACpE,IAAI,iBAAiB,OACnB,eAAA,SAAS,MAAM,OAAO;EAExB,aAAA,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
package/dist/run-DpAMfkm5.cjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
const require_agent = require("./agent-DElUuYuy.cjs");
|
|
2
|
-
const require_errors = require("./errors-BdA8M78q.cjs");
|
|
3
|
-
const require_output = require("./output-BnK0scpX.cjs");
|
|
4
|
-
const require_registry = require("./registry-DER9aRyg.cjs");
|
|
5
|
-
let node_util = require("node:util");
|
|
6
|
-
let node_process = require("node:process");
|
|
7
|
-
node_process = require_agent.__toESM(node_process, 1);
|
|
8
|
-
let _kubb_core = require("@kubb/core");
|
|
9
|
-
//#region src/runners/list/run.ts
|
|
10
|
-
/**
|
|
11
|
-
* The installed packages that ship a `kubb-extension.json` or have a registry entry, with the
|
|
12
|
-
* version the registry pins.
|
|
13
|
-
*/
|
|
14
|
-
async function listExtensions({ cwd, registry }) {
|
|
15
|
-
const [installed, entries] = await Promise.all([(0, _kubb_core.readInstalledPackages)({ root: cwd }), require_registry.fetchRegistryIndex({ registry }).catch((error) => {
|
|
16
|
-
require_output.logWarn(`Showing installed extensions only: ${require_errors.getErrorMessage(error)}`);
|
|
17
|
-
return [];
|
|
18
|
-
})]);
|
|
19
|
-
const byPackage = new Map(entries.map((entry) => [entry.artifact.package, entry]));
|
|
20
|
-
return installed.flatMap(({ package: name, version, manifest }) => {
|
|
21
|
-
const entry = byPackage.get(name);
|
|
22
|
-
if (!entry && !manifest) return [];
|
|
23
|
-
const latest = entry?.artifact.version;
|
|
24
|
-
return [{
|
|
25
|
-
id: entry?.id,
|
|
26
|
-
package: name,
|
|
27
|
-
installed: version,
|
|
28
|
-
registry: latest,
|
|
29
|
-
update: !!latest && require_registry.isOutdated({
|
|
30
|
-
installed: version,
|
|
31
|
-
latest
|
|
32
|
-
})
|
|
33
|
-
}];
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
/** Prints the installed extensions as a table. */
|
|
37
|
-
async function run() {
|
|
38
|
-
try {
|
|
39
|
-
const rows = await listExtensions({
|
|
40
|
-
cwd: node_process.default.cwd(),
|
|
41
|
-
registry: require_registry.registryUrl()
|
|
42
|
-
});
|
|
43
|
-
if (!rows.length) {
|
|
44
|
-
require_output.logOutro("No installed extensions found.");
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
const header = [
|
|
48
|
-
"ID",
|
|
49
|
-
"PACKAGE",
|
|
50
|
-
"INSTALLED",
|
|
51
|
-
"REGISTRY",
|
|
52
|
-
"UPDATE"
|
|
53
|
-
];
|
|
54
|
-
const cells = rows.map((row) => [
|
|
55
|
-
row.id ?? "-",
|
|
56
|
-
row.package,
|
|
57
|
-
row.installed ?? "-",
|
|
58
|
-
row.registry ?? "-",
|
|
59
|
-
row.update ? "yes" : "no"
|
|
60
|
-
]);
|
|
61
|
-
const widths = header.map((title, index) => Math.max(title.length, ...cells.map((cell) => cell[index].length)));
|
|
62
|
-
const line = (cell) => cell.map((value, index) => value.padEnd(widths[index])).join(" ").trimEnd();
|
|
63
|
-
require_output.logBlock([(0, node_util.styleText)("dim", line(header)), ...cells.map(line)]);
|
|
64
|
-
} catch (error) {
|
|
65
|
-
require_output.logError(require_errors.getErrorMessage(error));
|
|
66
|
-
node_process.default.exitCode = 1;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
exports.run = run;
|
|
71
|
-
|
|
72
|
-
//# sourceMappingURL=run-DpAMfkm5.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"run-DpAMfkm5.cjs","names":["readInstalledPackages","fetchRegistryIndex","getErrorMessage","isOutdated","process","registryUrl","styleText"],"sources":["../src/runners/list/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { getErrorMessage } from '@internals/utils'\nimport { readInstalledPackages, type RegistryEntry } from '@kubb/core'\nimport { logBlock, logError, logOutro, logWarn } from '../../loggers/output.ts'\nimport { fetchRegistryIndex, isOutdated, registryUrl } from '../../utils/registry.ts'\n\nexport type ListRow = {\n id?: string\n package: string\n installed?: string\n registry?: string\n update: boolean\n}\n\n/**\n * The installed packages that ship a `kubb-extension.json` or have a registry entry, with the\n * version the registry pins.\n */\nexport async function listExtensions({ cwd, registry }: { cwd: string; registry: string }): Promise<Array<ListRow>> {\n const [installed, entries] = await Promise.all([\n readInstalledPackages({ root: cwd }),\n fetchRegistryIndex({ registry }).catch((error: unknown): Array<RegistryEntry> => {\n logWarn(`Showing installed extensions only: ${getErrorMessage(error)}`)\n return []\n }),\n ])\n const byPackage = new Map(entries.map((entry) => [entry.artifact.package, entry]))\n\n return installed.flatMap(({ package: name, version, manifest }): Array<ListRow> => {\n const entry = byPackage.get(name)\n if (!entry && !manifest) return []\n const latest = entry?.artifact.version\n return [{ id: entry?.id, package: name, installed: version, registry: latest, update: !!latest && isOutdated({ installed: version, latest }) }]\n })\n}\n\n/** Prints the installed extensions as a table. */\nexport async function run(): Promise<void> {\n try {\n const rows = await listExtensions({ cwd: process.cwd(), registry: registryUrl() })\n if (!rows.length) {\n logOutro('No installed extensions found.')\n return\n }\n\n const header = ['ID', 'PACKAGE', 'INSTALLED', 'REGISTRY', 'UPDATE']\n const cells = rows.map((row) => [row.id ?? '-', row.package, row.installed ?? '-', row.registry ?? '-', row.update ? 'yes' : 'no'])\n const widths = header.map((title, index) => Math.max(title.length, ...cells.map((cell) => cell[index]!.length)))\n const line = (cell: Array<string>) =>\n cell\n .map((value, index) => value.padEnd(widths[index]!))\n .join(' ')\n .trimEnd()\n\n logBlock([styleText('dim', line(header)), ...cells.map(line)])\n } catch (error) {\n logError(getErrorMessage(error))\n process.exitCode = 1\n }\n}\n"],"mappings":";;;;;;;;;;;;;AAmBA,eAAsB,eAAe,EAAE,KAAK,YAAwE;CAClH,MAAM,CAAC,WAAW,WAAW,MAAM,QAAQ,IAAI,EAAA,GAC7CA,WAAAA,sBAAAA,CAAsB,EAAE,MAAM,IAAI,CAAC,GACnCC,iBAAAA,mBAAmB,EAAE,SAAS,CAAC,CAAC,CAAC,OAAO,UAAyC;EAC/E,eAAA,QAAQ,sCAAsCC,eAAAA,gBAAgB,KAAK,GAAG;EACtE,OAAO,CAAC;CACV,CAAC,CACH,CAAC;CACD,MAAM,YAAY,IAAI,IAAI,QAAQ,KAAK,UAAU,CAAC,MAAM,SAAS,SAAS,KAAK,CAAC,CAAC;CAEjF,OAAO,UAAU,SAAS,EAAE,SAAS,MAAM,SAAS,eAA+B;EACjF,MAAM,QAAQ,UAAU,IAAI,IAAI;EAChC,IAAI,CAAC,SAAS,CAAC,UAAU,OAAO,CAAC;EACjC,MAAM,SAAS,OAAO,SAA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