@kubb/cli 5.14.5 → 5.15.0
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/bin/kubb.js +2 -1
- package/dist/{Telemetry-Dc79_cIA.js → Telemetry-B3edcFoB.js} +12 -86
- package/dist/Telemetry-B3edcFoB.js.map +1 -0
- package/dist/{Telemetry-Dc9DVxKQ.cjs → Telemetry-COWGqYmh.cjs} +14 -118
- package/dist/Telemetry-COWGqYmh.cjs.map +1 -0
- package/dist/{background-v5pDy3IJ.cjs → background-B24lIehn.cjs} +5 -6
- package/dist/{background-v5pDy3IJ.cjs.map → background-B24lIehn.cjs.map} +1 -1
- package/dist/{background-C877JFxE.js → background-D-7OGjvg.js} +1 -1
- package/dist/{background-3_KudPH-.js → background-_dKcGjM7.js} +5 -6
- package/dist/{background-3_KudPH-.js.map → background-_dKcGjM7.js.map} +1 -1
- package/dist/banner-BdTTDFkG.js +140 -0
- package/dist/banner-BdTTDFkG.js.map +1 -0
- package/dist/banner-wJFk-L-c.cjs +163 -0
- package/dist/banner-wJFk-L-c.cjs.map +1 -0
- package/dist/config-BL3HnFhb.js +1 -0
- package/dist/config-BWj9jBVj.cjs +62 -0
- package/dist/config-BWj9jBVj.cjs.map +1 -0
- package/dist/{config-CNqgDSu3.js → config-CQTxXvIG.js} +6 -52
- package/dist/config-CQTxXvIG.js.map +1 -0
- package/dist/{config-BG_Nr2CZ.cjs → config-CRrmj88c.cjs} +15 -62
- package/dist/config-CRrmj88c.cjs.map +1 -0
- package/dist/config-Uk3rbZfb.js +49 -0
- package/dist/config-Uk3rbZfb.js.map +1 -0
- package/dist/configFile-C0DIXNMD.js +993 -0
- package/dist/configFile-C0DIXNMD.js.map +1 -0
- package/dist/configFile-CoEpHdXG.cjs +1028 -0
- package/dist/configFile-CoEpHdXG.cjs.map +1 -0
- package/dist/{credentials-C8tjAhTo.js → credentials-B77iJx9H.js} +1 -1
- package/dist/{credentials-DDaKqtJn.cjs → credentials-DEsGwcGD.cjs} +3 -4
- package/dist/{credentials-DDaKqtJn.cjs.map → credentials-DEsGwcGD.cjs.map} +1 -1
- package/dist/{credentials-CZK6zPLv.js → credentials-osgjujE_.js} +3 -4
- package/dist/{credentials-CZK6zPLv.js.map → credentials-osgjujE_.js.map} +1 -1
- package/dist/env-C3xHRMez.js +1 -0
- package/dist/env-eu3XyKqJ.cjs +55 -0
- package/dist/env-eu3XyKqJ.cjs.map +1 -0
- package/dist/env-rv-VgSGN.js +34 -0
- package/dist/env-rv-VgSGN.js.map +1 -0
- package/dist/{errors-Cl69p_vI.cjs → errors-BponpdjN.cjs} +3 -4
- package/dist/{errors-Cl69p_vI.cjs.map → errors-BponpdjN.cjs.map} +1 -1
- package/dist/{errors-DmC83ALX.js → errors-wzqmMpMo.js} +3 -4
- package/dist/{errors-DmC83ALX.js.map → errors-wzqmMpMo.js.map} +1 -1
- package/dist/index.cjs +37 -2719
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +35 -2713
- package/dist/index.js.map +1 -1
- package/dist/installWithSpinner-DpnpxHq5.js +49 -0
- package/dist/installWithSpinner-DpnpxHq5.js.map +1 -0
- package/dist/installWithSpinner-ONGfIVUJ.cjs +56 -0
- package/dist/installWithSpinner-ONGfIVUJ.cjs.map +1 -0
- package/dist/{text-CEyJhBnh.js → intro-9PB8sE8z.js} +8 -52
- package/dist/intro-9PB8sE8z.js.map +1 -0
- package/dist/{text-CC2xdpGL.cjs → intro-YPaf1Imr.cjs} +12 -80
- package/dist/intro-YPaf1Imr.cjs.map +1 -0
- package/dist/isCIEnvironment-D6xtAAZ2.js +14 -0
- package/dist/isCIEnvironment-D6xtAAZ2.js.map +1 -0
- package/dist/isCIEnvironment-DiVOMI5Q.cjs +20 -0
- package/dist/isCIEnvironment-DiVOMI5Q.cjs.map +1 -0
- package/dist/mascot--q1xjKw1.js +63 -0
- package/dist/mascot--q1xjKw1.js.map +1 -0
- package/dist/mascot-JSA0j3Q_.cjs +80 -0
- package/dist/mascot-JSA0j3Q_.cjs.map +1 -0
- package/dist/mcp-CYPOFKnP.cjs +20 -0
- package/dist/mcp-CYPOFKnP.cjs.map +1 -0
- package/dist/mcp-CxeZR5vb.js +21 -0
- package/dist/mcp-CxeZR5vb.js.map +1 -0
- package/dist/package-D3Yss9Bb.js +5 -0
- package/dist/package-D3Yss9Bb.js.map +1 -0
- package/dist/package-aX0q9SZr.cjs +10 -0
- package/dist/package-aX0q9SZr.cjs.map +1 -0
- package/dist/{registry-ov1RYcD4.js → registry-B3eYk4LN.js} +7 -67
- package/dist/registry-B3eYk4LN.js.map +1 -0
- package/dist/{registry-BInbtBm7.cjs → registry-YE1pFWL-.cjs} +4 -82
- package/dist/registry-YE1pFWL-.cjs.map +1 -0
- package/dist/{reporters-DQz--AdE.cjs → reporters-2cgjvXwR.cjs} +32 -40
- package/dist/{reporters-DQz--AdE.cjs.map → reporters-2cgjvXwR.cjs.map} +1 -1
- package/dist/{reporters-BtD41K-C.js → reporters-BM430HdQ.js} +19 -27
- package/dist/{reporters-BtD41K-C.js.map → reporters-BM430HdQ.js.map} +1 -1
- package/dist/{rolldown-runtime-CPE0t6oh.cjs → rolldown-runtime-C3-Zg-KD.cjs} +1 -2
- package/dist/{rolldown-runtime-CRm0XQPb.js → rolldown-runtime-xo6NMXYd.js} +1 -2
- package/dist/run-1H9TGT8v.js +77 -0
- package/dist/run-1H9TGT8v.js.map +1 -0
- package/dist/run-B4zvF9WY.cjs +233 -0
- package/dist/run-B4zvF9WY.cjs.map +1 -0
- package/dist/run-BYP_t9dR.cjs +324 -0
- package/dist/run-BYP_t9dR.cjs.map +1 -0
- package/dist/{run-1oXPIkli.cjs → run-Bb19PlwV.cjs} +44 -37
- package/dist/run-Bb19PlwV.cjs.map +1 -0
- package/dist/{run-B03V0Poj.cjs → run-BoO7H8RA.cjs} +49 -41
- package/dist/run-BoO7H8RA.cjs.map +1 -0
- package/dist/run-BrM7-NSV.js +181 -0
- package/dist/run-BrM7-NSV.js.map +1 -0
- package/dist/{run-UsAMlUyy.js → run-C0KI-NE3.js} +9 -9
- package/dist/{run-UsAMlUyy.js.map → run-C0KI-NE3.js.map} +1 -1
- package/dist/run-CCLPt4hr.js +1 -0
- package/dist/run-CCsdLz3X.js +385 -0
- package/dist/run-CCsdLz3X.js.map +1 -0
- package/dist/{run-YMSJnvYl.js → run-CbX6tpqB.js} +31 -23
- package/dist/run-CbX6tpqB.js.map +1 -0
- package/dist/run-CrM4jsix.cjs +80 -0
- package/dist/run-CrM4jsix.cjs.map +1 -0
- package/dist/run-CvFakE3B.cjs +185 -0
- package/dist/run-CvFakE3B.cjs.map +1 -0
- package/dist/run-D-nn9-Wq.js +319 -0
- package/dist/run-D-nn9-Wq.js.map +1 -0
- package/dist/{run-cBSr2F1q.cjs → run-D5Z6nfzK.cjs} +5 -6
- package/dist/{run-cBSr2F1q.cjs.map → run-D5Z6nfzK.cjs.map} +1 -1
- package/dist/{run-BUzdEUaE.cjs → run-DCqmf5W1.cjs} +10 -10
- package/dist/{run-BUzdEUaE.cjs.map → run-DCqmf5W1.cjs.map} +1 -1
- package/dist/{run-BK-A9JDf.js → run-DFXhBS64.js} +5 -6
- package/dist/{run-BK-A9JDf.js.map → run-DFXhBS64.js.map} +1 -1
- package/dist/run-DgGZOC_x.cjs +389 -0
- package/dist/run-DgGZOC_x.cjs.map +1 -0
- package/dist/{run-DDwdeHgU.js → run-KqdudiWQ.js} +26 -20
- package/dist/run-KqdudiWQ.js.map +1 -0
- package/dist/run-RN_31Q4u.js +228 -0
- package/dist/run-RN_31Q4u.js.map +1 -0
- package/dist/shared-C0EtrdUm.cjs +123 -0
- package/dist/shared-C0EtrdUm.cjs.map +1 -0
- package/dist/shared-Ct9stKpp.js +94 -0
- package/dist/shared-Ct9stKpp.js.map +1 -0
- package/dist/{snapshot-BrwynBfC.cjs → snapshot-D7Ytw8S0.cjs} +13 -14
- package/dist/{snapshot-BrwynBfC.cjs.map → snapshot-D7Ytw8S0.cjs.map} +1 -1
- package/dist/{snapshot-D2E7nhEf.js → snapshot-n7dJGCWv.js} +10 -11
- package/dist/{snapshot-D2E7nhEf.js.map → snapshot-n7dJGCWv.js.map} +1 -1
- package/dist/spinner-BZaln7O8.js +160 -0
- package/dist/spinner-BZaln7O8.js.map +1 -0
- package/dist/spinner-CfB0sIPy.cjs +208 -0
- package/dist/spinner-CfB0sIPy.cjs.map +1 -0
- package/dist/{status-CxzhvjKs.cjs → status-Bc0_4T41.cjs} +7 -8
- package/dist/{status-CxzhvjKs.cjs.map → status-Bc0_4T41.cjs.map} +1 -1
- package/dist/{status-BHIOMCM0.js → status-DxSkp1cH.js} +6 -7
- package/dist/{status-BHIOMCM0.js.map → status-DxSkp1cH.js.map} +1 -1
- package/dist/studio-BpYwgFb0.cjs +218 -0
- package/dist/studio-BpYwgFb0.cjs.map +1 -0
- package/dist/studio-mw6HaPkr.js +215 -0
- package/dist/studio-mw6HaPkr.js.map +1 -0
- package/dist/studioWorker.js +4 -5
- package/dist/{summary-B219y888.js → summary-CbmQKA8l.js} +5 -6
- package/dist/{summary-B219y888.js.map → summary-CbmQKA8l.js.map} +1 -1
- package/dist/{summary-BOYsqub3.cjs → summary-Clvl5Hxs.cjs} +7 -8
- package/dist/{summary-BOYsqub3.cjs.map → summary-Clvl5Hxs.cjs.map} +1 -1
- package/dist/table-BlRe9YTZ.cjs +15 -0
- package/dist/table-BlRe9YTZ.cjs.map +1 -0
- package/dist/table-CR7iZJGo.js +10 -0
- package/dist/table-CR7iZJGo.js.map +1 -0
- package/dist/text-BmiI4s6N.js +13 -0
- package/dist/text-BmiI4s6N.js.map +1 -0
- package/dist/text-Ep3AulAS.cjs +24 -0
- package/dist/text-Ep3AulAS.cjs.map +1 -0
- package/dist/time-3BKoci3G.cjs +82 -0
- package/dist/time-3BKoci3G.cjs.map +1 -0
- package/dist/time-C-wU7VhC.js +65 -0
- package/dist/time-C-wU7VhC.js.map +1 -0
- package/dist/utils-BdibacYq.js +244 -0
- package/dist/utils-BdibacYq.js.map +1 -0
- package/dist/utils-CO89mxRU.cjs +290 -0
- package/dist/utils-CO89mxRU.cjs.map +1 -0
- package/dist/utils-CbJ6hS_t.js +222 -0
- package/dist/utils-CbJ6hS_t.js.map +1 -0
- package/dist/utils-CcARPB45.cjs +286 -0
- package/dist/utils-CcARPB45.cjs.map +1 -0
- package/dist/validate-8ZcWXfMt.js +28 -0
- package/dist/validate-8ZcWXfMt.js.map +1 -0
- package/dist/validate-CMSeDpGT.cjs +27 -0
- package/dist/validate-CMSeDpGT.cjs.map +1 -0
- package/package.json +7 -7
- package/dist/Telemetry-Dc79_cIA.js.map +0 -1
- package/dist/Telemetry-Dc9DVxKQ.cjs.map +0 -1
- package/dist/config-BG_Nr2CZ.cjs.map +0 -1
- package/dist/config-CNqgDSu3.js.map +0 -1
- package/dist/config-DWDpFSn1.js +0 -1
- package/dist/registry-BInbtBm7.cjs.map +0 -1
- package/dist/registry-ov1RYcD4.js.map +0 -1
- package/dist/run-1oXPIkli.cjs.map +0 -1
- package/dist/run-B03V0Poj.cjs.map +0 -1
- package/dist/run-DDwdeHgU.js.map +0 -1
- package/dist/run-YMSJnvYl.js.map +0 -1
- package/dist/run-v5aW1jjQ.js +0 -1
- package/dist/text-CC2xdpGL.cjs.map +0 -1
- package/dist/text-CEyJhBnh.js.map +0 -1
- package/dist/utils-8E1nF4C1.cjs +0 -645
- package/dist/utils-8E1nF4C1.cjs.map +0 -1
- package/dist/utils-D8VN40bN.js +0 -536
- package/dist/utils-D8VN40bN.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-CCsdLz3X.js","names":[],"sources":["../../../internals/shared/src/init.ts","../src/runners/init/run.ts"],"sourcesContent":["/** The `kubb.config.ts` `kubb init` writes before `kubb add` puts each plugin in. */\nexport function generateConfigFile({ inputPath, outputPath }: { inputPath: string; outputPath: string }): string {\n return `import { defineConfig } from 'kubb/config'\n\nexport default defineConfig({\n input: '${inputPath}',\n output: {\n path: '${outputPath}',\n clean: true,\n },\n plugins: [],\n})\n`\n}\n","import 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 { defineWithTypes } from 'gunshi'\nimport { ConfigEditOperation, editConfig, generateConfigFile, initDefaults, KUBB_CONFIG_FILENAME, KUBB_PACKAGE_NAME } from '@internals/shared'\nimport { exists, formatMs, getElapsedMs, write } from '@internals/utils'\nimport { createKubb, Diagnostics, type RegistryEntry } from '@kubb/core'\nimport { dryRunId, type DryRunExtensions } from '../../commands/shared.ts'\nimport { getConfigs } from '../../config.ts'\nimport { pluralize } from '../../ui/text.ts'\nimport { isInteractiveRun, logIntro, logOutro } from '../../ui/intro.ts'\nimport { logBlock, logError, logStep, logWarn } from '../../ui/log.ts'\nimport { createSpinner } from '../../ui/spinner.ts'\nimport { fetchRegistryIndex, incompatibility, installSpec, registryUrl } from '../../utils/registry.ts'\nimport { installWithSpinner } from '../installWithSpinner.ts'\nimport {\n addGenerateScript,\n detectPackageManager,\n findPlugin,\n findSpecFiles,\n generateScript,\n initPackageJson,\n installPackages,\n missingPluginDependencies,\n type PackageManagerInfo,\n parsePluginsFlag,\n readSpecInfo,\n} from './utils.ts'\nimport { version } from '../../../package.json'\n\nfunction cancelAndExit(message = 'Operation canceled.'): never {\n clack.cancel(message)\n process.exit(0)\n}\n\nfunction unwrap<T>(value: T): Exclude<T, symbol> {\n if (clack.isCancel(value)) cancelAndExit()\n return value as Exclude<T, symbol>\n}\n\ntype InitOptions = {\n /**\n * When `true`, skips all interactive prompts and uses the detected or default values.\n */\n yes: boolean\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,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, file\n * writes, and the first run are skipped.\n */\n dryRun: DryRunExtension\n}\n\ntype Choices = {\n inputPath: string\n outputPath: string\n plugins: Array<RegistryEntry>\n}\n\n/** The full `kubb.config.ts` for `choices`, with each plugin added the way `kubb add` adds it. */\nfunction buildConfig({ inputPath, outputPath, plugins }: Choices): string {\n const { source, outcomes } = editConfig({\n source: generateConfigFile({ inputPath, outputPath }),\n edits: plugins.map((entry) => ({ operation: ConfigEditOperation.ADD_PLUGIN, plugin: entry.artifact.package })),\n extensions: new Map(plugins.map(({ artifact, manifest }) => [artifact.package, { package: artifact.package, version: artifact.version, manifest }])),\n })\n const failed = outcomes.find((outcome) => !outcome.applied)\n if (failed && failed.edit.operation === ConfigEditOperation.ADD_PLUGIN)\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: `Could not add ${failed.edit.plugin} to ${KUBB_CONFIG_FILENAME}: ${failed.reason}`,\n help: `Run kubb init without that plugin, then add it with kubb add.`,\n })\n return source\n}\n\n/** Generates from the config at `configPath` without reporters, and returns how many files it wrote. */\nasync function firstRun(configPath: string): Promise<number> {\n const { configs } = await getConfigs({ configPath })\n let files = 0\n for (const config of configs) {\n const result = await createKubb(config).generate()\n if (!result.success) throw new Error(result.diagnostics.flatMap((diagnostic) => (diagnostic.severity === 'error' ? [diagnostic.message] : [])).join('\\n'))\n files += result.files.length\n }\n return files\n}\n\n/** The command that runs `kubb generate`: the `generate` script when it runs Kubb, otherwise `npx kubb generate`. */\nfunction generateCommand({ packageManager, script, watch }: { packageManager: PackageManagerInfo; script: string | undefined; watch: boolean }): string {\n if (script !== 'kubb generate') return `npx kubb generate${watch ? ' --watch' : ''}`\n const run = [packageManager.name, ...packageManager.runCommand, 'generate'].join(' ')\n if (!watch) return run\n return packageManager.name === 'npm' ? `${run} -- --watch` : `${run} --watch`\n}\n\n/**\n * Runs the Kubb setup wizard: detects the package manager and specs, asks for the spec, plugins, and\n * output folder, shows the config for review, then installs, writes `kubb.config.ts`, adds a\n * `generate` script, and runs the first generation.\n * Pass `yes: true` to skip all prompts and print one line per step.\n */\nexport async function run({ yes, input: inputFlag, output: outputFlag, plugins: pluginsFlag, dryRun }: InitOptions): Promise<void> {\n const cwd = process.cwd()\n\n /** Runs `task` behind a spinner, or prints one line when it is done in `--yes` mode. */\n async function step<T>({ start, task, done, failed }: { start: string; task: () => Promise<T>; done: (result: T) => string; failed: string }): Promise<T> {\n const spinner = createSpinner()\n if (!yes) spinner.start(start)\n try {\n const result = await task()\n if (yes) console.log(`${styleText('green', '✓')} ${done(result)}`)\n else spinner.stop(done(result))\n return result\n } catch (error) {\n if (!yes) spinner.error(failed)\n throw error\n }\n }\n\n if (!yes) logIntro({ title: isInteractiveRun({ yes, dryRun: dryRun.enabled }) ? undefined : 'Set up Kubb' })\n\n try {\n // Start the registry fetch now but await it only at the plugin step, so the first prompt never waits on the network\n const registry = fetchRegistryIndex({ registry: registryUrl() }).then((entries) =>\n entries.filter((entry) => entry.kind === 'plugin' && !incompatibility(entry.manifest)),\n )\n registry.catch(() => {})\n\n if (!(await exists(path.join(cwd, 'package.json')))) {\n if (!yes) {\n const shouldInit = unwrap(await clack.confirm({ message: 'No package.json found. Would you like to create one?', initialValue: true }))\n if (!shouldInit) cancelAndExit()\n }\n\n const packageManager = detectPackageManager(cwd)\n await step({\n start: `Initializing package.json with ${packageManager.name}`,\n task: () => initPackageJson(cwd, packageManager),\n done: () => `Created package.json with ${packageManager.name}`,\n failed: 'Could not create package.json',\n })\n }\n\n const packageManager = detectPackageManager(cwd)\n const specs = await findSpecFiles(cwd)\n\n if (!yes) {\n logStep(`Package manager ${packageManager.name}`)\n if (specs[0]) {\n const { version: specVersion, operations } = await readSpecInfo(path.join(cwd, specs[0]))\n const details = [\n specs[0].slice(2),\n specVersion ? `${specVersion.startsWith('2') ? 'Swagger' : 'OpenAPI'} ${specVersion}` : undefined,\n operations === undefined ? undefined : pluralize(operations, 'operation'),\n specs.length > 1 ? `+${specs.length - 1} more` : undefined,\n ]\n logStep(`Found ${details.filter(Boolean).join(' · ')}`)\n }\n }\n\n // `--plugins` and `--yes` need the registry before any prompt; the interactive path reads it at the plugin step\n const plugins = pluginsFlag || yes ? await registry : undefined\n const defaultPlugins = (entries: Array<RegistryEntry>) => initDefaults.plugins.flatMap((id) => findPlugin({ plugins: entries, id }) ?? [])\n\n const flagPlugins = pluginsFlag && plugins ? parsePluginsFlag({ plugins, value: pluginsFlag }) : undefined\n\n let choices: Choices = {\n inputPath: inputFlag ?? specs[0] ?? initDefaults.inputPath,\n outputPath: outputFlag ?? initDefaults.outputPath,\n plugins: flagPlugins ?? (plugins ? defaultPlugins(plugins) : []),\n }\n if (yes && !choices.plugins.length) {\n throw new Error('The registry has no default plugin. Pass --plugins to choose one.')\n }\n\n async function askInput(current: string): Promise<string> {\n const choice = specs.length\n ? unwrap(\n await clack.select({\n message: 'Which spec should Kubb read?',\n options: [\n ...specs.map((spec) => ({ value: spec, label: spec, hint: 'found in this repo' })),\n { value: 'url', label: 'A URL' },\n { value: 'file', label: 'Another file' },\n ],\n initialValue: specs.includes(current) ? current : /^https?:\\/\\//.test(current) ? 'url' : 'file',\n }),\n )\n : /^https?:\\/\\//.test(current)\n ? 'url'\n : 'file'\n if (specs.includes(choice)) return choice\n const isUrl = choice === 'url'\n const initial = isUrl === /^https?:\\/\\//.test(current) && !specs.includes(current) ? current : undefined\n return unwrap(\n await clack.text({\n message: isUrl ? 'Spec URL' : 'Spec path',\n placeholder: isUrl ? 'https://example.com/openapi.yaml' : initDefaults.inputPath,\n initialValue: initial,\n defaultValue: isUrl ? undefined : initDefaults.inputPath,\n validate: (value) => {\n if (isUrl && !/^https?:\\/\\//.test(value ?? '')) return 'Enter an http(s) URL'\n },\n }),\n )\n }\n\n async function askPlugins(previous: Array<RegistryEntry>): Promise<Array<RegistryEntry>> {\n const plugins = await registry\n const current = previous.length ? previous : defaultPlugins(plugins)\n const width = Math.max(...plugins.map((entry) => entry.manifest.displayName.length))\n const nameWidth = Math.max(...plugins.map((entry) => entry.manifest.name.length))\n const values = unwrap(\n await clack.multiselect({\n message: 'What should Kubb generate?',\n options: plugins.map(({ id, manifest }) => ({\n value: id,\n label: `${manifest.displayName.padEnd(width)} ${styleText('dim', manifest.name.padEnd(nameWidth))}`.trimEnd(),\n })),\n initialValues: current.map((entry) => entry.id),\n required: true,\n }),\n )\n return plugins.filter((entry) => values.includes(entry.id))\n }\n\n // Flags for all three choices leave nothing to ask or review, as before the review step existed\n const answered = yes || Boolean(inputFlag && outputFlag && pluginsFlag)\n if (!answered) {\n let firstPass = true\n while (true) {\n // The first pass skips the questions a flag answered; \"Change a choice\" asks them all again.\n choices = {\n inputPath: firstPass && inputFlag ? inputFlag : await askInput(choices.inputPath),\n plugins: firstPass && flagPlugins ? flagPlugins : await askPlugins(choices.plugins),\n outputPath:\n firstPass && outputFlag\n ? outputFlag\n : unwrap(await clack.text({ message: 'Output folder', placeholder: choices.outputPath, defaultValue: choices.outputPath })),\n }\n firstPass = false\n const missing = missingPluginDependencies(choices.plugins.map((entry) => entry.manifest))\n if (missing.length) {\n logWarn(`${missing.join('\\n')}\\nAdd the missing plugins.`)\n continue\n }\n const config = buildConfig(choices)\n const packages = [KUBB_PACKAGE_NAME, ...choices.plugins.map((entry) => entry.artifact.package)]\n logStep(`Review ${KUBB_CONFIG_FILENAME}`)\n logBlock([...config.trimEnd().split('\\n'), '', `${styleText('dim', 'Installs')} ${packages.join(' ')} with ${packageManager.name}`])\n const configExists = await exists(path.join(cwd, KUBB_CONFIG_FILENAME))\n const confirmed = unwrap(\n await clack.select({\n message: configExists ? `${KUBB_CONFIG_FILENAME} exists. Overwrite it?` : 'Create it?',\n options: [\n { value: true, label: 'Yes' },\n { value: false, label: 'Change a choice' },\n ],\n }),\n )\n if (confirmed) break\n }\n }\n\n // Check the selection against the plugins' manifests before installing anything\n const missing = missingPluginDependencies(choices.plugins.map((entry) => entry.manifest))\n if (missing.length) {\n throw new Diagnostics.Error({\n code: Diagnostics.code.missingDependency,\n severity: 'error',\n message: `${missing.join('\\n')}\\nAdd the missing plugins and run kubb init again.`,\n })\n }\n\n const configPath = path.join(cwd, KUBB_CONFIG_FILENAME)\n if (answered && !yes && (await exists(configPath))) {\n const overwrite = unwrap(await clack.confirm({ message: `${KUBB_CONFIG_FILENAME} exists. Overwrite it?`, initialValue: false }))\n if (!overwrite) cancelAndExit('Keeping existing configuration.')\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}`, ...choices.plugins.map((entry) => installSpec(entry.artifact))]\n const packageNames = [KUBB_PACKAGE_NAME, ...choices.plugins.map((entry) => entry.artifact.package)]\n const dry = { message: `install ${packagesToInstall.length} packages with ${packageManager.name}` }\n if (yes) {\n await step({\n start: '',\n task: async () => void (await dryRun.run(() => installPackages(packagesToInstall, packageManager, cwd), dry)),\n done: () => `Installed ${packageNames.join(' ')} with ${packageManager.name}`,\n failed: 'Installation failed',\n })\n } else {\n await installWithSpinner({\n packages: packagesToInstall,\n names: `${packagesToInstall.length} packages`,\n packageManager,\n cwd,\n install: async (packages, packageManager, cwd, onLine) => void (await dryRun.run(() => installPackages(packages, packageManager, cwd, onLine), dry)),\n })\n }\n\n await step({\n start: `Writing ${KUBB_CONFIG_FILENAME}`,\n task: async () => dryRun.run(async () => void (await write(configPath, buildConfig(choices))), { message: `write ${KUBB_CONFIG_FILENAME}` }),\n done: () => `Wrote ${KUBB_CONFIG_FILENAME}`,\n failed: `Could not write ${KUBB_CONFIG_FILENAME}`,\n })\n\n const scriptAdded = await dryRun.run(() => addGenerateScript(cwd), {\n message: 'add a generate script to package.json',\n resolve: async () => (await generateScript(cwd)) === undefined,\n })\n if (scriptAdded && !yes) logStep('Added \"generate\": \"kubb generate\" to package.json')\n\n const script = scriptAdded ? 'kubb generate' : await generateScript(cwd)\n const runStart = process.hrtime()\n try {\n await dryRun.run(\n () =>\n step({\n start: 'Running the first generation',\n task: () => firstRun(configPath),\n done: (files) =>\n yes\n ? `Generated ${pluralize(files, 'file')} in ${choices.outputPath}`\n : `First run ${pluralize(files, 'file')} in ${choices.outputPath} · ${formatMs(getElapsedMs(runStart))}`,\n failed: 'First run failed',\n }),\n { message: 'run the first generation', resolve: () => 0 },\n )\n } catch (error) {\n logError(error instanceof Error ? error.message : String(error))\n const message = `Kubb is set up, but the first run failed. Fix the error, then run ${generateCommand({ packageManager, script, watch: false })}.`\n if (yes) console.log(message)\n else logOutro(styleText('yellow', message))\n process.exitCode = 1\n return\n }\n\n if (yes) {\n console.log(`Kubb is set up. Run ${generateCommand({ packageManager, script, watch: false })} after changing the spec.`)\n return\n }\n logOutro(`${styleText('green', '✓ Kubb is set up')}\\n ${styleText('dim', 'Next')} ${generateCommand({ packageManager, script, watch: true })}`)\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)\n }\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description: 'Set up a config, install plugins, and run the first generation.',\n examples: [\n 'kubb init',\n 'kubb init --yes',\n 'kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod',\n 'kubb init --yes --input ./openapi.yaml --plugins ts,zod --output src/api',\n 'kubb init --plugins plugin-ts,plugin-axios,plugin-react-query',\n 'kubb init --yes --dry-run',\n ].join('\\n'),\n toKebab: true,\n args: {\n yes: {\n type: 'boolean',\n description: 'Skip prompts and use the detected spec, the default plugin, and the default output folder',\n short: 'y',\n default: false,\n },\n input: {\n type: 'string',\n description: 'Path to the OpenAPI specification',\n short: 'i',\n metavar: 'path',\n },\n output: {\n type: 'string',\n description: 'Output directory for generated files',\n short: 'o',\n metavar: 'path',\n },\n plugins: {\n type: 'string',\n description:\n 'Comma-separated Kubb registry ids of the plugins to add, the same ids `kubb add` takes (plugin-ts, plugin-zod, acme/plugin-x), or short names (ts, zod)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n run: ({ values, extensions }) => run({ yes: values.yes, input: values.input, output: values.output, plugins: values.plugins, dryRun: extensions[dryRunId] }),\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AACA,SAAgB,mBAAmB,EAAE,WAAW,cAAiE;CAC/G,OAAO;;;YAGG,UAAU;;aAET,WAAW;;;;;;AAMxB;;ACmBA,SAAS,cAAc,UAAU,uBAA8B;CAC7D,MAAM,OAAO,OAAO;CACpB,QAAQ,KAAK,CAAC;AAChB;AAEA,SAAS,OAAU,OAA8B;CAC/C,IAAI,MAAM,SAAS,KAAK,GAAG,cAAc;CACzC,OAAO;AACT;;AAiCA,SAAS,YAAY,EAAE,WAAW,YAAY,WAA4B;CACxE,MAAM,EAAE,QAAQ,aAAa,WAAW;EACtC,QAAQ,mBAAmB;GAAE;GAAW;EAAW,CAAC;EACpD,OAAO,QAAQ,KAAK,WAAW;GAAE,WAAW,oBAAoB;GAAY,QAAQ,MAAM,SAAS;EAAQ,EAAE;EAC7G,YAAY,IAAI,IAAI,QAAQ,KAAK,EAAE,UAAU,eAAe,CAAC,SAAS,SAAS;GAAE,SAAS,SAAS;GAAS,SAAS,SAAS;GAAS;EAAS,CAAC,CAAC,CAAC;CACrJ,CAAC;CACD,MAAM,SAAS,SAAS,MAAM,YAAY,CAAC,QAAQ,OAAO;CAC1D,IAAI,UAAU,OAAO,KAAK,cAAc,oBAAoB,YAC1D,MAAM,IAAI,YAAY,MAAM;EAC1B,MAAM,YAAY,KAAK;EACvB,UAAU;EACV,SAAS,iBAAiB,OAAO,KAAK,OAAO,MAAM,qBAAqB,IAAI,OAAO;EACnF,MAAM;CACR,CAAC;CACH,OAAO;AACT;;AAGA,eAAe,SAAS,YAAqC;CAC3D,MAAM,EAAE,YAAY,MAAM,WAAW,EAAE,WAAW,CAAC;CACnD,IAAI,QAAQ;CACZ,KAAK,MAAM,UAAU,SAAS;EAC5B,MAAM,SAAS,MAAM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uB,gBAAgB;IAAE;IAAgB;IAAQ,OAAO;GAAM,CAAC,EAAE,0BAA0B;GACvH;EACF;EACA,SAAS,GAAG,UAAU,SAAS,kBAAkB,EAAE,OAAO,UAAU,OAAO,MAAM,EAAE,IAAI,gBAAgB;GAAE;GAAgB;GAAQ,OAAO;EAAK,CAAC,GAAG;CACnJ,SAAS,OAAO;EACd,SAAS,UAAU,OAAO,yCAAyC,CAAC;EACpE,IAAI,iBAAiB,OACnB,SAAS,MAAM,OAAO;EAExB,QAAQ,KAAK,CAAC;CAChB;AACF;AAEA,MAAa,UAAU,gBAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aAAa;CACb,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,SAAS;CACT,MAAM;EACJ,KAAK;GACH,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aACE;GACF,SAAS;EACX;CACF;CACA,MAAM,EAAE,QAAQ,iBAAiB,IAAI;EAAE,KAAK,OAAO;EAAK,OAAO,OAAO;EAAO,QAAQ,OAAO;EAAQ,SAAS,OAAO;EAAS,QAAQ,WAAW;CAAU,CAAC;AAC7J,CAAC"}
|
|
@@ -1,15 +1,20 @@
|
|
|
1
|
-
import "./rolldown-runtime-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { n as
|
|
1
|
+
import "./rolldown-runtime-xo6NMXYd.js";
|
|
2
|
+
import { n as getElapsedMs, t as formatMs } from "./time-C-wU7VhC.js";
|
|
3
|
+
import { t as createSpinner } from "./spinner-BZaln7O8.js";
|
|
4
|
+
import { i as listenForKeys, o as startWatcher, s as trackBuild, t as diffBuilds } from "./utils-BdibacYq.js";
|
|
5
|
+
import { t as version } from "./package-D3Yss9Bb.js";
|
|
6
|
+
import { n as trackRun } from "./Telemetry-B3edcFoB.js";
|
|
7
|
+
import { a as logTip, c as logInfo, f as createPlainWriter, i as logSpacer, l as logStep, n as logIntro, r as logOutro, s as logError, u as logWarn } from "./intro-9PB8sE8z.js";
|
|
8
|
+
import { n as logBanner } from "./mascot--q1xjKw1.js";
|
|
9
|
+
import { t as pluralize } from "./text-BmiI4s6N.js";
|
|
10
|
+
import { n as setupReporters, t as selectReporters } from "./reporters-BM430HdQ.js";
|
|
11
|
+
import { t as getConfigs } from "./config-Uk3rbZfb.js";
|
|
12
|
+
import { o as isOutdated } from "./registry-B3eYk4LN.js";
|
|
8
13
|
import { styleText } from "node:util";
|
|
9
14
|
import process from "node:process";
|
|
10
15
|
import path from "node:path";
|
|
11
16
|
import { Diagnostics, Hookable, cliReporter, createKubb, fileReporter, getInputKind, htmlReporter, jsonReporter, logLevel, memoryStorage } from "@kubb/core";
|
|
12
|
-
|
|
17
|
+
// src/runners/generate/run.ts
|
|
13
18
|
/** NPM registry endpoint used to check for @kubb/cli updates. */
|
|
14
19
|
const KUBB_NPM_PACKAGE_URL = "https://registry.npmjs.org/@kubb/cli/latest";
|
|
15
20
|
/** Upper bound in milliseconds for the npm update check, so a slow registry never stalls a run. */
|
|
@@ -33,7 +38,7 @@ async function generate(options) {
|
|
|
33
38
|
};
|
|
34
39
|
const kubb = createKubb(config, { hooks });
|
|
35
40
|
const result = await kubb.generate();
|
|
36
|
-
|
|
41
|
+
report({
|
|
37
42
|
plugins: kubb.config.plugins.flatMap((p) => p && typeof p === "object" ? [{
|
|
38
43
|
name: p.meta?.name ?? p.name ?? "",
|
|
39
44
|
options: p.options ?? {}
|
|
@@ -43,16 +48,15 @@ async function generate(options) {
|
|
|
43
48
|
});
|
|
44
49
|
return result.success;
|
|
45
50
|
}
|
|
46
|
-
/** The latest published version, `undefined` when the registry does not answer in time. Never rejects. */
|
|
47
|
-
async function fetchLatestVersion() {
|
|
51
|
+
/** The latest published version, `undefined` when the registry does not answer in time or `signal` aborts. Never rejects. */
|
|
52
|
+
async function fetchLatestVersion(signal) {
|
|
48
53
|
try {
|
|
49
|
-
return (await (await fetch(KUBB_NPM_PACKAGE_URL, { signal: AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS) })).json()).version;
|
|
54
|
+
return (await (await fetch(KUBB_NPM_PACKAGE_URL, { signal: AbortSignal.any([signal, AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS)]) })).json()).version;
|
|
50
55
|
} catch {
|
|
51
56
|
return;
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
|
-
async function checkForUpdate({ hooks,
|
|
55
|
-
const latestVersion = await latest;
|
|
59
|
+
async function checkForUpdate({ hooks, latestVersion }) {
|
|
56
60
|
if (latestVersion && isOutdated({
|
|
57
61
|
installed: version,
|
|
58
62
|
latest: latestVersion
|
|
@@ -74,10 +78,14 @@ function logRebuild({ diff: { schemas, operations }, durationMs }) {
|
|
|
74
78
|
/**
|
|
75
79
|
* Runs the full Kubb generation lifecycle for the given CLI options.
|
|
76
80
|
* Loads configs, sets up the reporters (CLI `--reporter` picks which of `config.reporters` to trigger),
|
|
77
|
-
*
|
|
81
|
+
* calls `generate` for each config entry, and prints an update notice when the registry answered in time.
|
|
78
82
|
*/
|
|
79
83
|
async function run({ input, configPath, logLevel: logLevelKey, watch, reporters: cliReporters, dryRun }) {
|
|
80
|
-
const
|
|
84
|
+
const updateCheck = new AbortController();
|
|
85
|
+
let latestVersion;
|
|
86
|
+
fetchLatestVersion(updateCheck.signal).then((value) => {
|
|
87
|
+
latestVersion = value;
|
|
88
|
+
});
|
|
81
89
|
const logLevel$1 = logLevel[logLevelKey] ?? logLevel.info;
|
|
82
90
|
const hooks = new Hookable();
|
|
83
91
|
const requestedNames = cliReporters?.length ? cliReporters : ["cli"];
|
|
@@ -131,10 +139,6 @@ async function run({ input, configPath, logLevel: logLevelKey, watch, reporters:
|
|
|
131
139
|
dryRun
|
|
132
140
|
});
|
|
133
141
|
await hooks.callHook("kubb:lifecycle:start", { version });
|
|
134
|
-
await checkForUpdate({
|
|
135
|
-
hooks,
|
|
136
|
-
latest
|
|
137
|
-
});
|
|
138
142
|
if (!quiet) logOutro(`${pluralize(configs.length, "config")} ready`);
|
|
139
143
|
try {
|
|
140
144
|
let anyFailed = false;
|
|
@@ -204,15 +208,19 @@ async function run({ input, configPath, logLevel: logLevelKey, watch, reporters:
|
|
|
204
208
|
}
|
|
205
209
|
}
|
|
206
210
|
}
|
|
211
|
+
updateCheck.abort();
|
|
212
|
+
await checkForUpdate({
|
|
213
|
+
hooks,
|
|
214
|
+
latestVersion
|
|
215
|
+
});
|
|
207
216
|
await hooks.callHook("kubb:lifecycle:end");
|
|
208
217
|
if (!quiet && !watch && !anyFailed) logTip();
|
|
209
|
-
if (anyFailed) process.
|
|
218
|
+
if (anyFailed) process.exitCode = 1;
|
|
210
219
|
} catch (error) {
|
|
211
220
|
await Diagnostics.emit(errorHooks, error);
|
|
212
221
|
process.exit(1);
|
|
213
222
|
}
|
|
214
223
|
}
|
|
215
|
-
//#endregion
|
|
216
224
|
export { generate, run };
|
|
217
225
|
|
|
218
|
-
//# sourceMappingURL=run-
|
|
226
|
+
//# sourceMappingURL=run-CbX6tpqB.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-CbX6tpqB.js","names":["logLevel","logLevelMap"],"sources":["../src/runners/generate/run.ts"],"sourcesContent":["import path from 'node:path'\nimport process from 'node:process'\nimport { styleText } from 'node:util'\nimport { formatMs, formatters, getElapsedMs, linters } from '@internals/utils'\nimport {\n Hookable,\n type CLIOptions,\n cliReporter,\n type Config,\n createKubb,\n Diagnostics,\n fileReporter,\n getInputKind,\n htmlReporter,\n jsonReporter,\n type KubbHooks,\n logLevel as logLevelMap,\n memoryStorage,\n type ReporterName,\n} from '@kubb/core'\nimport { version } from '../../../package.json'\nimport { trackRun } from '../../Telemetry.ts'\nimport { pluralize } from '../../ui/text.ts'\nimport setupReporters, { selectReporters } from '../../loggers/reporters.ts'\nimport { createPlainWriter } from '../../loggers/plainWriter.ts'\nimport { logIntro, logOutro, logSpacer, logTip } from '../../ui/intro.ts'\nimport { logError, logInfo, logStep, logWarn } from '../../ui/log.ts'\nimport { logBanner } from '../../ui/mascot.ts'\nimport { createSpinner } from '../../ui/spinner.ts'\nimport { getConfigs } from '../../config.ts'\nimport { isOutdated } from '../../utils/registry.ts'\nimport { type BuildDiff, type BuildSnapshot, diffBuilds, listenForKeys, startWatcher, trackBuild } from './utils.ts'\n\n/** NPM registry endpoint used to check for @kubb/cli updates. */\nconst KUBB_NPM_PACKAGE_URL = 'https://registry.npmjs.org/@kubb/cli/latest' as const\n\n/** Upper bound in milliseconds for the npm update check, so a slow registry never stalls a run. */\nconst UPDATE_CHECK_TIMEOUT_MS = 3_000\n\n/** The formatter names from `Config['output'].format`, without `'auto'` (detection, not a tool) and `false` (skip). */\ntype FormatterName = Exclude<NonNullable<Config['output']['format']>, 'auto' | false>\ntype LinterName = Exclude<NonNullable<Config['output']['lint']>, 'auto' | false>\n\n// Pinned here, not in `@internals/utils` (which must not import `@kubb/core`): a tool added to the union without a descriptor fails to compile.\nformatters satisfies Record<FormatterName, unknown>\nlinters satisfies Record<LinterName, unknown>\n\ntype GenerateProps = {\n input?: string\n config: Config\n hooks: Hookable<KubbHooks>\n /**\n * When `true`, generates in memory instead of writing to disk, skips formatting, linting, and\n * post-generate commands, and prints what would change on disk.\n */\n dryRun?: boolean\n}\n\nexport async function generate(options: GenerateProps): Promise<boolean> {\n const { input, hooks, dryRun = false } = options\n\n const report = trackRun({ command: 'generate', hrStart: process.hrtime() })\n\n const config: Config = {\n ...options.config,\n input: input ?? options.config.input,\n // Dry-run never touches disk, regardless of the config's own storage driver.\n storage: dryRun ? memoryStorage() : options.config.storage,\n // Also keeps core's `hasOutputPasses` false, so dry-run skips the output manifest write too.\n output: dryRun ? { ...options.config.output, format: false, lint: false, postGenerate: [] } : options.config.output,\n }\n\n // Core formats, lints and runs `output.postGenerate` after an error-free build, and reports\n // their failures as coded diagnostics that reach the summary, the json report and the exit code.\n const kubb = createKubb(config, { hooks })\n const result = await kubb.generate()\n\n // Not awaited: the request finishes in the background, capped by its timeout, so it never delays the summary.\n void report({\n // A setup that threw leaves no driver, so read the configured plugins instead.\n plugins: kubb.config.plugins.flatMap((p) =>\n p && typeof p === 'object' ? [{ name: p.meta?.name ?? p.name ?? '', options: (p.options ?? {}) as Record<string, unknown> }] : [],\n ),\n filesCreated: result.files.length,\n status: result.success ? 'success' : 'failed',\n })\n\n return result.success\n}\n\ntype GenerateCommandOptions = {\n input?: string\n configPath?: string\n logLevel: string\n watch: boolean\n reporters?: Array<ReporterName>\n dryRun?: boolean\n}\n\n/** The latest published version, `undefined` when the registry does not answer in time or `signal` aborts. Never rejects. */\nasync function fetchLatestVersion(signal: AbortSignal): Promise<string | undefined> {\n try {\n const res = await fetch(KUBB_NPM_PACKAGE_URL, { signal: AbortSignal.any([signal, AbortSignal.timeout(UPDATE_CHECK_TIMEOUT_MS)]) })\n const data = (await res.json()) as { version: string }\n return data.version\n } catch {\n // Ignore network errors\n return undefined\n }\n}\n\nasync function checkForUpdate({ hooks, latestVersion }: { hooks: Hookable<KubbHooks>; latestVersion: string | undefined }): Promise<void> {\n if (latestVersion && isOutdated({ installed: version, latest: latestVersion })) {\n await Diagnostics.emit(hooks, Diagnostics.update({ currentVersion: version, latestVersion }))\n }\n}\n\n/** Prints `Rebuilt in 1.2s · +1 schema -2 operations`, without the names part when the spec kept the same names. */\nfunction logRebuild({ diff: { schemas, operations }, durationMs }: { diff: BuildDiff; durationMs: number }): void {\n const specChange = [\n schemas.added && styleText('green', `+${pluralize(schemas.added, 'schema')}`),\n schemas.removed && styleText('red', `-${pluralize(schemas.removed, 'schema')}`),\n operations.added && styleText('green', `+${pluralize(operations.added, 'operation')}`),\n operations.removed && styleText('red', `-${pluralize(operations.removed, 'operation')}`),\n ]\n .filter(Boolean)\n .join(' ')\n logStep([`Rebuilt in ${formatMs(durationMs)}`, specChange].filter(Boolean).join(styleText('dim', ' · ')))\n}\n\n/**\n * Runs the full Kubb generation lifecycle for the given CLI options.\n * Loads configs, sets up the reporters (CLI `--reporter` picks which of `config.reporters` to trigger),\n * calls `generate` for each config entry, and prints an update notice when the registry answered in time.\n */\nexport async function run({ input, configPath, logLevel: logLevelKey, watch, reporters: cliReporters, dryRun }: GenerateCommandOptions): Promise<void> {\n // Started first and never awaited: the notice prints at the end only when the registry has answered by then.\n const updateCheck = new AbortController()\n let latestVersion: string | undefined\n void fetchLatestVersion(updateCheck.signal).then((value) => {\n latestVersion = value\n })\n const logLevel = logLevelMap[logLevelKey as keyof typeof logLevelMap] ?? logLevelMap.info\n const hooks = new Hookable<KubbHooks>()\n\n // CLI `--reporter` selects which reporters to trigger by name, defaulting to `cli`. `defineConfig`\n // registers the built-in reporters on the config; a config exported without it falls back to them below.\n const requestedNames: Array<ReporterName> = cliReporters?.length ? cliReporters : ['cli']\n\n // The `json` reporter owns stdout, so the command writes nothing of its own around it.\n const json = requestedNames.includes('json')\n const quiet = logLevel <= logLevelMap.silent || json\n\n // Errors raised outside a build have no report entry. In `json` mode they go to a stderr logger,\n // so they are never silent and stdout stays one JSON document.\n const errorHooks = json ? new Hookable<KubbHooks>() : hooks\n if (json) setupReporters(errorHooks, { logLevel, reporters: [cliReporter], writer: createPlainWriter(console.error) })\n\n // The config loads while the banner plays; the output still prints in order once the banner is done.\n const banner = quiet ? undefined : logBanner(version)\n const loading = getConfigs({\n configPath,\n input,\n watch,\n logLevel: logLevelKey as CLIOptions['logLevel'],\n })\n // Handled below; this keeps a rejection during the banner from counting as unhandled.\n loading.catch(() => undefined)\n await banner\n\n if (!quiet) {\n logIntro({ title: 'Configuration' })\n }\n\n // Load the config first so `config.reporters` can pick the reporters. A failure here has no\n // reporter installed yet, so fall back to the default `cli` reporter to surface it.\n const configSpinner = createSpinner()\n let configs: Array<Config>\n let resolvedConfigPath: string\n try {\n if (!quiet) configSpinner.start('Loading config')\n\n const loaded = await loading\n configs = loaded.configs\n resolvedConfigPath = loaded.configPath\n\n if (!quiet) configSpinner.stop(`Loaded ${styleText('dim', path.relative(process.cwd(), resolvedConfigPath))}`)\n } catch (error) {\n if (!quiet) configSpinner.error('Config failed loading')\n\n if (!json) setupReporters(hooks, { logLevel, reporters: [cliReporter] })\n // A diagnostic thrown while the config file runs, such as invalid extension options, sits in the cause chain.\n await Diagnostics.emit(errorHooks, error)\n\n if (!quiet) logOutro(styleText('red', '✗ Configuration failed'))\n process.exit(1)\n }\n\n // Without a reporter nothing is printed, not even an error, so a config written without\n // `defineConfig` gets the same built-ins it would have registered.\n const available = configs[0]?.reporters?.length ? configs[0].reporters : [cliReporter, jsonReporter, fileReporter, htmlReporter]\n const reporters = selectReporters(available, requestedNames)\n setupReporters(hooks, { logLevel, reporters, dryRun })\n\n await hooks.callHook('kubb:lifecycle:start', { version })\n\n if (!quiet) logOutro(`${pluralize(configs.length, 'config')} ready`)\n\n try {\n let anyFailed = false\n // One tracker, one key listener and one build queue serve every watched config, so several configs never mix diffs or answer `r` twice.\n const tracker = watch ? trackBuild(hooks) : undefined\n const rebuilds: Array<() => Promise<void>> = []\n let armKeys: (() => void) | undefined\n // Configs share the hooks emitter, so every build, from any watcher or the `r` key, waits for the one before it.\n let queue = Promise.resolve()\n for (const config of configs) {\n const effectiveInput = input ?? config.input\n const inputKind = typeof effectiveInput === 'string' ? getInputKind(effectiveInput) : undefined\n const watchPath = inputKind === 'file' ? (effectiveInput as string) : undefined\n if (watchPath && tracker) {\n const label = styleText('yellow', `Watching ${path.relative(process.cwd(), watchPath)}`)\n let previous: BuildSnapshot | undefined\n // Don't removeAll() between builds, that would also drop logger and lifecycle\n // listeners. Plugin listeners are already disposed by safeBuild's dispose()\n // in its finally block, so re-running generate() on the same hooks emitter is safe.\n const build = async () => {\n const hrStart = process.hrtime()\n const succeeded = await generate({ input, config, hooks, dryRun })\n const snapshot = tracker.take()\n if (previous) logRebuild({ diff: diffBuilds(previous, snapshot), durationMs: getElapsedMs(hrStart) })\n previous = snapshot\n\n logStep(armKeys ? `${label} ${styleText('dim', 'r rebuild · q quit')}` : label)\n armKeys?.()\n if (succeeded) {\n logSpacer()\n logTip()\n }\n }\n // A trigger that lands while this config's build is queued joins it; one that lands during the build queues one more. Never rejects.\n let pending = false\n const rebuild = (): Promise<void> => {\n if (pending) return queue\n pending = true\n queue = queue\n .then(() => {\n pending = false\n return build()\n })\n .catch((error) => void Diagnostics.emit(errorHooks, error))\n return queue\n }\n rebuilds.push(rebuild)\n if (!quiet) {\n armKeys ??= listenForKeys({\n rebuild: () => rebuilds.forEach((trigger) => void trigger()),\n quit: (code) => void Promise.resolve(hooks.callHook('kubb:lifecycle:end')).finally(() => process.exit(code)),\n })\n }\n\n // The watcher ignores its startup state, so run the first build here; a failing one keeps watching so the user can fix the input.\n await rebuild()\n\n await startWatcher([watchPath], rebuild, { info: logInfo, error: logError })\n } else {\n if (tracker && !quiet) logWarn('Watch mode only follows a local `input` file, so this config is generated once.')\n try {\n const succeeded = await generate({ input, config, hooks, dryRun })\n if (!succeeded) anyFailed = true\n } catch (configError) {\n await Diagnostics.emit(errorHooks, configError)\n anyFailed = true\n }\n }\n }\n\n // A request still in flight would keep the process alive until its timeout.\n updateCheck.abort()\n await checkForUpdate({ hooks, latestVersion })\n\n await hooks.callHook('kubb:lifecycle:end')\n\n // Watch mode prints a tip after each successful build. Regular generate commands need to\n // print one explicitly after the lifecycle group has closed so it stays outside the group.\n if (!quiet && !watch && !anyFailed) {\n logTip()\n }\n\n // `exitCode`, not `exit()`, so a telemetry request still in flight can finish within its timeout.\n if (anyFailed) {\n process.exitCode = 1\n }\n } catch (error) {\n await Diagnostics.emit(errorHooks, error)\n process.exit(1)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAM,uBAAuB;;AAG7B,MAAM,0BAA0B;AAqBhC,eAAsB,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Y,MAAM;EAClB,MAAM,eAAe;GAAE;GAAO;EAAc,CAAC;EAE7C,MAAM,MAAM,SAAS,oBAAoB;EAIzC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,WACvB,OAAO;EAIT,IAAI,WACF,QAAQ,WAAW;CAEvB,SAAS,OAAO;EACd,MAAM,YAAY,KAAK,YAAY,KAAK;EACxC,QAAQ,KAAK,CAAC;CAChB;AACF"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C3-Zg-KD.cjs");
|
|
2
|
+
const require_errors = require("./errors-BponpdjN.cjs");
|
|
3
|
+
const require_intro = require("./intro-YPaf1Imr.cjs");
|
|
4
|
+
const require_registry = require("./registry-YE1pFWL-.cjs");
|
|
5
|
+
const require_table = require("./table-BlRe9YTZ.cjs");
|
|
6
|
+
let node_util = require("node:util");
|
|
7
|
+
let gunshi = require("gunshi");
|
|
8
|
+
let node_process = require("node:process");
|
|
9
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
10
|
+
let _kubb_core = require("@kubb/core");
|
|
11
|
+
// src/runners/list/run.ts
|
|
12
|
+
/**
|
|
13
|
+
* The installed packages that ship a `kubb-extension.json` or have a registry entry, with the
|
|
14
|
+
* version the registry pins.
|
|
15
|
+
*/
|
|
16
|
+
async function listExtensions({ cwd, registry }) {
|
|
17
|
+
const [installed, entries] = await Promise.all([(0, _kubb_core.readInstalledPackages)({ root: cwd }), require_registry.fetchRegistryIndex({ registry }).catch((error) => {
|
|
18
|
+
require_intro.logWarn(`Showing installed extensions only: ${require_errors.getErrorMessage(error)}`);
|
|
19
|
+
return [];
|
|
20
|
+
})]);
|
|
21
|
+
const byPackage = new Map(entries.map((entry) => [entry.artifact.package, entry]));
|
|
22
|
+
return installed.flatMap(({ package: name, version, manifest }) => {
|
|
23
|
+
const entry = byPackage.get(name);
|
|
24
|
+
if (!entry && !manifest) return [];
|
|
25
|
+
const latest = entry?.artifact.version;
|
|
26
|
+
return [{
|
|
27
|
+
id: entry?.id,
|
|
28
|
+
package: name,
|
|
29
|
+
installed: version,
|
|
30
|
+
registry: latest,
|
|
31
|
+
update: !!latest && require_registry.isOutdated({
|
|
32
|
+
installed: version,
|
|
33
|
+
latest
|
|
34
|
+
})
|
|
35
|
+
}];
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
/** Prints the installed extensions as a table. */
|
|
39
|
+
async function run() {
|
|
40
|
+
try {
|
|
41
|
+
const rows = await listExtensions({
|
|
42
|
+
cwd: node_process.default.cwd(),
|
|
43
|
+
registry: require_registry.registryUrl()
|
|
44
|
+
});
|
|
45
|
+
if (!rows.length) {
|
|
46
|
+
require_intro.logOutro("No installed extensions found.");
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const header = [
|
|
50
|
+
"ID",
|
|
51
|
+
"PACKAGE",
|
|
52
|
+
"INSTALLED",
|
|
53
|
+
"REGISTRY",
|
|
54
|
+
"UPDATE"
|
|
55
|
+
];
|
|
56
|
+
const cells = rows.map((row) => [
|
|
57
|
+
row.id ?? "-",
|
|
58
|
+
row.package,
|
|
59
|
+
row.installed ?? "-",
|
|
60
|
+
row.registry ?? "-",
|
|
61
|
+
row.update ? "yes" : "no"
|
|
62
|
+
]);
|
|
63
|
+
const [head, ...body] = require_table.formatTable([header, ...cells]);
|
|
64
|
+
require_intro.logBlock([(0, node_util.styleText)("dim", head), ...body]);
|
|
65
|
+
} catch (error) {
|
|
66
|
+
require_intro.logError(require_errors.getErrorMessage(error));
|
|
67
|
+
node_process.default.exitCode = 1;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const command = (0, gunshi.define)({
|
|
71
|
+
name: "list",
|
|
72
|
+
description: "List installed extensions, their versions, and available updates.",
|
|
73
|
+
examples: "kubb list",
|
|
74
|
+
run: () => run()
|
|
75
|
+
});
|
|
76
|
+
exports.command = command;
|
|
77
|
+
exports.listExtensions = listExtensions;
|
|
78
|
+
exports.run = run;
|
|
79
|
+
|
|
80
|
+
//# sourceMappingURL=run-CrM4jsix.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-CrM4jsix.cjs","names":["readInstalledPackages","fetchRegistryIndex","getErrorMessage","isOutdated","process","registryUrl","formatTable","styleText","define"],"sources":["../src/runners/list/run.ts"],"sourcesContent":["import process from 'node:process'\nimport { styleText } from 'node:util'\nimport { getErrorMessage } from '@internals/utils'\nimport { define } from 'gunshi'\nimport { readInstalledPackages, type RegistryEntry } from '@kubb/core'\nimport { logOutro } from '../../ui/intro.ts'\nimport { logBlock, logError, logWarn } from '../../ui/log.ts'\nimport { formatTable } from '../../ui/table.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 [head, ...body] = formatTable([header, ...cells])\n logBlock([styleText('dim', head!), ...body])\n } catch (error) {\n logError(getErrorMessage(error))\n process.exitCode = 1\n }\n}\n\nexport const command = define({\n name: 'list',\n description: 'List installed extensions, their versions, and available updates.',\n examples: 'kubb list',\n run: () => run(),\n})\n"],"mappings":";;;;;;;;;;;;;;;AAsBA,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,cAAA,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,SAAS;EAC/B,OAAO,CAAC;GAAE,IAAI,OAAO;GAAI,SAAS;GAAM,WAAW;GAAS,UAAU;GAAQ,QAAQ,CAAC,CAAC,UAAUC,iBAAAA,WAAW;IAAE,WAAW;IAAS;GAAO,CAAC;EAAE,CAAC;CAChJ,CAAC;AACH;;AAGA,eAAsB,MAAqB;CACzC,IAAI;EACF,MAAM,OAAO,MAAM,eAAe;GAAE,KAAKC,aAAAA,QAAQ,IAAI;GAAG,UAAUC,iBAAAA,YAAY;EAAE,CAAC;EACjF,IAAI,CAAC,KAAK,QAAQ;GAChB,cAAA,SAAS,gCAAgC;GACzC;EACF;EAEA,MAAM,SAAS;GAAC;GAAM;GAAW;GAAa;GAAY;EAAQ;EAClE,MAAM,QAAQ,KAAK,KAAK,QAAQ;GAAC,IAAI,MAAM;GAAK,IAAI;GAAS,IAAI,aAAa;GAAK,IAAI,YAAY;GAAK,IAAI,SAAS,QAAQ;EAAI,CAAC;EAClI,MAAM,CAAC,MAAM,GAAG,QAAQC,cAAAA,YAAY,CAAC,QAAQ,GAAG,KAAK,CAAC;EACtD,cAAA,SAAS,EAAA,GAACC,UAAAA,UAAAA,CAAU,OAAO,IAAK,GAAG,GAAG,IAAI,CAAC;CAC7C,SAAS,OAAO;EACd,cAAA,SAASL,eAAAA,gBAAgB,KAAK,CAAC;EAC/B,aAAA,QAAA,WAAmB;CACrB;AACF;AAEA,MAAa,WAAA,GAAUM,OAAAA,OAAAA,CAAO;CAC5B,MAAM;CACN,aAAa;CACb,UAAU;CACV,WAAW,IAAI;AACjB,CAAC"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
const require_rolldown_runtime = require("./rolldown-runtime-C3-Zg-KD.cjs");
|
|
2
|
+
const require_configFile = require("./configFile-CoEpHdXG.cjs");
|
|
3
|
+
const require_errors = require("./errors-BponpdjN.cjs");
|
|
4
|
+
const require_spinner = require("./spinner-CfB0sIPy.cjs");
|
|
5
|
+
const require_intro = require("./intro-YPaf1Imr.cjs");
|
|
6
|
+
const require_shared = require("./shared-C0EtrdUm.cjs");
|
|
7
|
+
const require_config = require("./config-CRrmj88c.cjs");
|
|
8
|
+
const require_summary = require("./summary-Clvl5Hxs.cjs");
|
|
9
|
+
const require_registry = require("./registry-YE1pFWL-.cjs");
|
|
10
|
+
const require_utils = require("./utils-CO89mxRU.cjs");
|
|
11
|
+
let node_util = require("node:util");
|
|
12
|
+
let gunshi = require("gunshi");
|
|
13
|
+
let node_process = require("node:process");
|
|
14
|
+
node_process = require_rolldown_runtime.__toESM(node_process, 1);
|
|
15
|
+
let node_path = require("node:path");
|
|
16
|
+
node_path = require_rolldown_runtime.__toESM(node_path, 1);
|
|
17
|
+
let _clack_prompts = require("@clack/prompts");
|
|
18
|
+
_clack_prompts = require_rolldown_runtime.__toESM(_clack_prompts, 1);
|
|
19
|
+
let _kubb_core = require("@kubb/core");
|
|
20
|
+
// src/runners/remove/run.ts
|
|
21
|
+
/** The lines of `before` that `after` no longer has, trimmed. */
|
|
22
|
+
function removedLines({ before, after }) {
|
|
23
|
+
const remaining = after.split("\n");
|
|
24
|
+
return before.split("\n").filter((line) => {
|
|
25
|
+
const index = remaining.indexOf(line);
|
|
26
|
+
if (index !== -1) remaining.splice(index, 1);
|
|
27
|
+
return index === -1 && line.trim() !== "";
|
|
28
|
+
}).map((line) => line.trim());
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Removes a plugin or parser from `kubb.config.ts` and uninstalls its package. Refuses the adapter,
|
|
32
|
+
* which the config needs, and an extension another one in the config depends on. Previews the
|
|
33
|
+
* change before asking.
|
|
34
|
+
*/
|
|
35
|
+
async function run({ id: input, configPath, yes, uninstall }) {
|
|
36
|
+
const cwd = node_process.default.cwd();
|
|
37
|
+
const hrStart = node_process.default.hrtime();
|
|
38
|
+
const summary = (title, status, lines) => require_summary.logCommandSummary({
|
|
39
|
+
title,
|
|
40
|
+
status,
|
|
41
|
+
hrStart,
|
|
42
|
+
block: true,
|
|
43
|
+
lines
|
|
44
|
+
});
|
|
45
|
+
const fail = (title, lines) => {
|
|
46
|
+
summary(title, "failed", lines);
|
|
47
|
+
node_process.default.exitCode = 1;
|
|
48
|
+
};
|
|
49
|
+
require_intro.logIntro({ title: require_intro.isInteractiveRun({ yes }) ? void 0 : (0, node_util.styleText)("bgCyan", (0, node_util.styleText)("black", " Kubb Remove ")) });
|
|
50
|
+
try {
|
|
51
|
+
const id = require_registry.toRegistryId(input);
|
|
52
|
+
const configFile = configPath ? node_path.default.resolve(configPath) : require_config.findConfigFile(cwd);
|
|
53
|
+
if (!configFile) throw new _kubb_core.Diagnostics.Error({
|
|
54
|
+
code: _kubb_core.Diagnostics.code.unknown,
|
|
55
|
+
severity: "error",
|
|
56
|
+
message: "No kubb.config.ts found. Pass its path with --config.",
|
|
57
|
+
help: "Run `kubb remove <id> --config <path>`."
|
|
58
|
+
});
|
|
59
|
+
const configName = node_path.default.relative(cwd, configFile) || configFile;
|
|
60
|
+
const [entries, installed, source] = await require_spinner.withSpinner({
|
|
61
|
+
message: "Reading the registry",
|
|
62
|
+
promise: Promise.all([
|
|
63
|
+
require_registry.fetchRegistryIndex({ registry: require_registry.registryUrl() }),
|
|
64
|
+
(0, _kubb_core.readInstalledPackages)({ root: cwd }),
|
|
65
|
+
require_spinner.read(configFile)
|
|
66
|
+
])
|
|
67
|
+
});
|
|
68
|
+
const versions = new Map(installed.map((item) => [item.package, item.version]));
|
|
69
|
+
const entry = entries.find((candidate) => candidate.id === id);
|
|
70
|
+
if (!entry) {
|
|
71
|
+
const suggestions = require_registry.closestIds({
|
|
72
|
+
input: id,
|
|
73
|
+
ids: entries.map((candidate) => candidate.id)
|
|
74
|
+
}).map(require_registry.toShortId);
|
|
75
|
+
return fail(`No extension named ${input}`, suggestions.map((suggestion) => ` kubb remove ${suggestion}`));
|
|
76
|
+
}
|
|
77
|
+
const { artifact, manifest } = entry;
|
|
78
|
+
const kind = manifest.kind.charAt(0).toUpperCase() + manifest.kind.slice(1);
|
|
79
|
+
if (manifest.kind === require_configFile.extensionKinds.adapter) return fail("The adapter cannot be removed", [` A config needs one adapter. Change it in ${configName} by hand.`]);
|
|
80
|
+
const view = require_configFile.readConfig(source);
|
|
81
|
+
const running = new Set(view.managed ? view.configs.flatMap((config) => [...config.plugins, ...config.parsers ?? []].filter((call) => !call.disabled).map((call) => call.packageName)) : []);
|
|
82
|
+
const dependents = entries.filter((other) => other.id !== entry.id && other.manifest.dependencies?.includes(manifest.name) && running.has(other.artifact.package));
|
|
83
|
+
if (dependents.length) {
|
|
84
|
+
const names = dependents.map((other) => other.manifest.name).join(", ");
|
|
85
|
+
return fail(`${names} ${dependents.length === 1 ? "needs" : "need"} ${manifest.name}`, [` Remove ${names} first.`]);
|
|
86
|
+
}
|
|
87
|
+
const edits = [{
|
|
88
|
+
operation: require_configFile.ConfigEditOperation.REMOVE_EXTENSION,
|
|
89
|
+
...manifest.kind === require_configFile.extensionKinds.parser ? { kind: require_configFile.extensionKinds.parser } : {},
|
|
90
|
+
plugin: artifact.package
|
|
91
|
+
}];
|
|
92
|
+
const preview = require_configFile.editConfig({
|
|
93
|
+
source,
|
|
94
|
+
edits
|
|
95
|
+
});
|
|
96
|
+
const outcome = preview.outcomes[0];
|
|
97
|
+
if (!outcome?.applied) return fail(`Could not edit ${configName}`, [` ${outcome?.reason ?? "the config file was not changed"}`]);
|
|
98
|
+
const bundled = require_config.BUNDLED_PACKAGES.includes(artifact.package);
|
|
99
|
+
const stillImported = require_configFile.readImports(preview.source).includes(artifact.package);
|
|
100
|
+
const uninstalls = uninstall && !bundled && !stillImported && versions.has(artifact.package);
|
|
101
|
+
if (!preview.changed && !uninstalls) {
|
|
102
|
+
summary(`${manifest.name} is not in the project`, "success", [" No changes made"]);
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const packageLine = (() => {
|
|
106
|
+
if (uninstalls) return `Uninstalls ${artifact.package}`;
|
|
107
|
+
if (bundled) return `Keeps ${artifact.package}, which ships with kubb`;
|
|
108
|
+
if (stillImported) return `Keeps ${artifact.package}, which another config entry still imports`;
|
|
109
|
+
return "Uninstalls nothing";
|
|
110
|
+
})();
|
|
111
|
+
require_intro.logStep(`${kind} ${(0, node_util.styleText)("cyan", manifest.name)} v${versions.get(artifact.package) ?? artifact.version}`);
|
|
112
|
+
require_intro.logBlock([
|
|
113
|
+
`Config ${configName}`,
|
|
114
|
+
...removedLines({
|
|
115
|
+
before: source,
|
|
116
|
+
after: preview.source
|
|
117
|
+
}).map((line) => (0, node_util.styleText)("red", ` - ${line}`)),
|
|
118
|
+
packageLine
|
|
119
|
+
]);
|
|
120
|
+
const confirmed = yes || await _clack_prompts.confirm({
|
|
121
|
+
message: "Remove it?",
|
|
122
|
+
initialValue: true
|
|
123
|
+
});
|
|
124
|
+
if (_clack_prompts.isCancel(confirmed) || !confirmed) {
|
|
125
|
+
summary("Remove canceled", "canceled", [` ${kind} ${manifest.name}`, " No changes made"]);
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
if (preview.changed) {
|
|
129
|
+
const written = await require_configFile.editConfigFile({
|
|
130
|
+
filePath: configFile,
|
|
131
|
+
edits
|
|
132
|
+
});
|
|
133
|
+
if (!written.outcomes[0]?.applied) return fail(`Could not edit ${configName}`, [` ${written.outcomes[0]?.reason ?? "the config file was not changed"}`]);
|
|
134
|
+
require_intro.logStep(`${manifest.export}() removed from ${configName}`);
|
|
135
|
+
}
|
|
136
|
+
const packageManager = require_utils.detectPackageManager(cwd);
|
|
137
|
+
if (uninstalls) await require_spinner.withSpinner({
|
|
138
|
+
message: `Uninstalling ${artifact.package} with ${packageManager.name}`,
|
|
139
|
+
promise: require_utils.uninstallPackages([artifact.package], packageManager, cwd)
|
|
140
|
+
});
|
|
141
|
+
summary(`${kind} removed`, "success", [
|
|
142
|
+
` Packages ${uninstalls ? `${artifact.package} uninstalled with ${packageManager.name}` : "none uninstalled"}`,
|
|
143
|
+
"",
|
|
144
|
+
"Next kubb generate"
|
|
145
|
+
]);
|
|
146
|
+
} catch (error) {
|
|
147
|
+
require_intro.logError(require_errors.getErrorMessage(error));
|
|
148
|
+
fail("Remove failed", [" See the error above"]);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
const command = (0, gunshi.define)({
|
|
152
|
+
name: "remove",
|
|
153
|
+
description: "Remove a plugin or parser from kubb.config.ts and uninstall its package.",
|
|
154
|
+
examples: [
|
|
155
|
+
"kubb remove plugin-zod",
|
|
156
|
+
"kubb remove acme/plugin-x --yes",
|
|
157
|
+
"kubb remove plugin-zod --no-uninstall"
|
|
158
|
+
].join("\n"),
|
|
159
|
+
toKebab: true,
|
|
160
|
+
args: {
|
|
161
|
+
id: {
|
|
162
|
+
type: "positional",
|
|
163
|
+
description: "Registry id: owner/slug, or a slug for an official extension",
|
|
164
|
+
required: true
|
|
165
|
+
},
|
|
166
|
+
...require_shared.configArg,
|
|
167
|
+
...require_shared.yesArg,
|
|
168
|
+
uninstall: {
|
|
169
|
+
type: "boolean",
|
|
170
|
+
description: "Uninstall the package. Pass --no-uninstall to only edit the config",
|
|
171
|
+
negatable: true,
|
|
172
|
+
default: true
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
run: ({ values }) => run({
|
|
176
|
+
id: values.id,
|
|
177
|
+
configPath: values.config,
|
|
178
|
+
yes: values.yes,
|
|
179
|
+
uninstall: values.uninstall
|
|
180
|
+
})
|
|
181
|
+
});
|
|
182
|
+
exports.command = command;
|
|
183
|
+
exports.run = run;
|
|
184
|
+
|
|
185
|
+
//# sourceMappingURL=run-CvFakE3B.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-CvFakE3B.cjs","names":["process","logCommandSummary","isInteractiveRun","styleText","toRegistryId","path","findConfigFile","Diagnostics","withSpinner","fetchRegistryIndex","registryUrl","readInstalledPackages","read","closestIds","toShortId","extensionKinds","readConfig","ConfigEditOperation","editConfig","BUNDLED_PACKAGES","readImports","clack","editConfigFile","detectPackageManager","uninstallPackages","getErrorMessage","define","configArg","yesArg"],"sources":["../src/runners/remove/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 { define } from 'gunshi'\nimport { BUNDLED_PACKAGES, ConfigEditOperation, extensionKinds, editConfig, editConfigFile, findConfigFile, readConfig, readImports } from '@internals/shared'\nimport { getErrorMessage, read } from '@internals/utils'\nimport { Diagnostics, readInstalledPackages } from '@kubb/core'\nimport { configArg, yesArg } from '../../commands/shared.ts'\nimport { isInteractiveRun, logIntro } from '../../ui/intro.ts'\nimport { logBlock, logError, logStep } from '../../ui/log.ts'\nimport { withSpinner } from '../../ui/spinner.ts'\nimport { logCommandSummary } from '../../ui/summary.ts'\nimport { closestIds, fetchRegistryIndex, registryUrl, toRegistryId, toShortId } from '../../utils/registry.ts'\nimport { detectPackageManager, uninstallPackages } from '../init/utils.ts'\n\nexport type RemoveOptions = {\n /**\n * `owner/slug`, or a bare `slug` for an official extension.\n */\n id: string\n configPath?: string\n yes: boolean\n uninstall: boolean\n}\n\n/** The lines of `before` that `after` no longer has, trimmed. */\nfunction removedLines({ before, after }: { before: string; after: string }): Array<string> {\n const remaining = after.split('\\n')\n return before\n .split('\\n')\n .filter((line) => {\n const index = remaining.indexOf(line)\n if (index !== -1) remaining.splice(index, 1)\n return index === -1 && line.trim() !== ''\n })\n .map((line) => line.trim())\n}\n\n/**\n * Removes a plugin or parser from `kubb.config.ts` and uninstalls its package. Refuses the adapter,\n * which the config needs, and an extension another one in the config depends on. Previews the\n * change before asking.\n */\nexport async function run({ id: input, configPath, yes, uninstall }: RemoveOptions): Promise<void> {\n const cwd = process.cwd()\n const hrStart = process.hrtime()\n const summary = (title: string, status: Parameters<typeof logCommandSummary>[0]['status'], lines: ReadonlyArray<string>) =>\n logCommandSummary({ title, status, hrStart, block: true, lines })\n const fail = (title: string, lines: ReadonlyArray<string>) => {\n summary(title, 'failed', lines)\n process.exitCode = 1\n }\n logIntro({ title: isInteractiveRun({ yes }) ? undefined : styleText('bgCyan', styleText('black', ' Kubb Remove ')) })\n\n try {\n const id = toRegistryId(input)\n const configFile = configPath ? path.resolve(configPath) : findConfigFile(cwd)\n if (!configFile)\n throw new Diagnostics.Error({\n code: Diagnostics.code.unknown,\n severity: 'error',\n message: 'No kubb.config.ts found. Pass its path with --config.',\n help: 'Run `kubb remove <id> --config <path>`.',\n })\n const configName = path.relative(cwd, configFile) || configFile\n const [entries, installed, source] = await withSpinner({\n message: 'Reading the registry',\n promise: Promise.all([fetchRegistryIndex({ registry: registryUrl() }), readInstalledPackages({ root: cwd }), read(configFile)]),\n })\n const versions = new Map(installed.map((item) => [item.package, item.version]))\n\n const entry = entries.find((candidate) => candidate.id === id)\n if (!entry) {\n const suggestions = closestIds({ input: id, ids: entries.map((candidate) => candidate.id) }).map(toShortId)\n return fail(\n `No extension named ${input}`,\n suggestions.map((suggestion) => ` kubb remove ${suggestion}`),\n )\n }\n const { artifact, manifest } = entry\n const kind = manifest.kind.charAt(0).toUpperCase() + manifest.kind.slice(1)\n if (manifest.kind === extensionKinds.adapter)\n return fail('The adapter cannot be removed', [` A config needs one adapter. Change it in ${configName} by hand.`])\n\n // Only calls that run count: a plugin Studio switched off is a comment, as in Studio's own check.\n const view = readConfig(source)\n const running = new Set(\n view.managed\n ? view.configs.flatMap((config) => [...config.plugins, ...(config.parsers ?? [])].filter((call) => !call.disabled).map((call) => call.packageName))\n : [],\n )\n const dependents = entries.filter(\n (other) => other.id !== entry.id && other.manifest.dependencies?.includes(manifest.name) && running.has(other.artifact.package),\n )\n if (dependents.length) {\n const names = dependents.map((other) => other.manifest.name).join(', ')\n return fail(`${names} ${dependents.length === 1 ? 'needs' : 'need'} ${manifest.name}`, [` Remove ${names} first.`])\n }\n\n const edits = [\n {\n operation: ConfigEditOperation.REMOVE_EXTENSION,\n ...(manifest.kind === extensionKinds.parser ? { kind: extensionKinds.parser } : {}),\n plugin: artifact.package,\n },\n ]\n const preview = editConfig({ source, edits })\n const outcome = preview.outcomes[0]\n if (!outcome?.applied) return fail(`Could not edit ${configName}`, [` ${outcome?.reason ?? 'the config file was not changed'}`])\n\n // Bundled extensions leave the config but stay installed.\n const bundled = BUNDLED_PACKAGES.includes(artifact.package)\n // Another `defineConfig` entry can still import it, and uninstalling it then breaks the config.\n const stillImported = readImports(preview.source).includes(artifact.package)\n const uninstalls = uninstall && !bundled && !stillImported && versions.has(artifact.package)\n if (!preview.changed && !uninstalls) {\n summary(`${manifest.name} is not in the project`, 'success', [' No changes made'])\n return\n }\n\n const packageLine = (() => {\n if (uninstalls) return `Uninstalls ${artifact.package}`\n if (bundled) return `Keeps ${artifact.package}, which ships with kubb`\n if (stillImported) return `Keeps ${artifact.package}, which another config entry still imports`\n return 'Uninstalls nothing'\n })()\n logStep(`${kind} ${styleText('cyan', manifest.name)} v${versions.get(artifact.package) ?? artifact.version}`)\n logBlock([\n `Config ${configName}`,\n ...removedLines({ before: source, after: preview.source }).map((line) => styleText('red', ` - ${line}`)),\n packageLine,\n ])\n\n const confirmed = yes || (await clack.confirm({ message: 'Remove it?', initialValue: true }))\n if (clack.isCancel(confirmed) || !confirmed) {\n summary('Remove canceled', 'canceled', [` ${kind} ${manifest.name}`, ' No changes made'])\n return\n }\n\n if (preview.changed) {\n const written = await editConfigFile({ filePath: configFile, edits })\n if (!written.outcomes[0]?.applied) return fail(`Could not edit ${configName}`, [` ${written.outcomes[0]?.reason ?? 'the config file was not changed'}`])\n logStep(`${manifest.export}() removed from ${configName}`)\n }\n const packageManager = detectPackageManager(cwd)\n if (uninstalls)\n await withSpinner({\n message: `Uninstalling ${artifact.package} with ${packageManager.name}`,\n promise: uninstallPackages([artifact.package], packageManager, cwd),\n })\n\n summary(`${kind} removed`, 'success', [\n ` Packages ${uninstalls ? `${artifact.package} uninstalled with ${packageManager.name}` : 'none uninstalled'}`,\n '',\n 'Next kubb generate',\n ])\n } catch (error) {\n logError(getErrorMessage(error))\n fail('Remove failed', [' See the error above'])\n }\n}\n\nexport const command = define({\n name: 'remove',\n description: 'Remove a plugin or parser from kubb.config.ts and uninstall its package.',\n examples: ['kubb remove plugin-zod', 'kubb remove acme/plugin-x --yes', 'kubb remove plugin-zod --no-uninstall'].join('\\n'),\n toKebab: true,\n args: {\n id: {\n type: 'positional',\n description: 'Registry id: owner/slug, or a slug for an official extension',\n required: true,\n },\n ...configArg,\n ...yesArg,\n uninstall: {\n type: 'boolean',\n description: 'Uninstall the package. Pass --no-uninstall to only edit the config',\n negatable: true,\n default: true,\n },\n },\n run: ({ values }) => run({ id: values.id, configPath: values.config, yes: values.yes, uninstall: values.uninstall }),\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;A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