@kubb/cli 5.3.0 → 5.3.2
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/README.md +27 -23
- package/dist/{generate-DnOsvKdA.js → generate-CuOh9cQF.js} +8 -6
- package/dist/generate-CuOh9cQF.js.map +1 -0
- package/dist/{generate-CCjNi8-B.cjs → generate-DtsFV9_7.cjs} +8 -6
- package/dist/generate-DtsFV9_7.cjs.map +1 -0
- package/dist/index.cjs +40 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +40 -9
- package/dist/index.js.map +1 -1
- package/dist/{init-BEZE-TU-.cjs → init-DlefULI4.cjs} +4 -3
- package/dist/init-DlefULI4.cjs.map +1 -0
- package/dist/{init-DFBbp97w.js → init-Mfgx1m1H.js} +4 -3
- package/dist/init-Mfgx1m1H.js.map +1 -0
- package/dist/package-C8jSgTtL.js +6 -0
- package/dist/package-C8jSgTtL.js.map +1 -0
- package/dist/{package-DgNWnCoo.cjs → package-VYHX-Cpv.cjs} +2 -2
- package/dist/package-VYHX-Cpv.cjs.map +1 -0
- package/dist/{run-Bh9GxeT8.cjs → run-BKJr0PQx.cjs} +2 -2
- package/dist/{run-Bh9GxeT8.cjs.map → run-BKJr0PQx.cjs.map} +1 -1
- package/dist/{run-DiL672xB.js → run-Bq7Mqn5d.js} +2 -2
- package/dist/{run-DiL672xB.js.map → run-Bq7Mqn5d.js.map} +1 -1
- package/dist/{run-BwMRCeWt.cjs → run-CKI6slB-.cjs} +2 -2
- package/dist/{run-BwMRCeWt.cjs.map → run-CKI6slB-.cjs.map} +1 -1
- package/dist/{run-B1-xSKKe.js → run-CUcyZyr4.js} +2 -2
- package/dist/{run-B1-xSKKe.js.map → run-CUcyZyr4.js.map} +1 -1
- package/dist/{run-CZaUf7i2.js → run-Cf5cTwV7.js} +2 -2
- package/dist/{run-CZaUf7i2.js.map → run-Cf5cTwV7.js.map} +1 -1
- package/dist/{run-CDLUop5s.cjs → run-DCd70CQu.cjs} +2 -2
- package/dist/{run-CDLUop5s.cjs.map → run-DCd70CQu.cjs.map} +1 -1
- package/dist/{run-BWahaRPU.cjs → run-Pdr1Evo4.cjs} +2 -2
- package/dist/{run-BWahaRPU.cjs.map → run-Pdr1Evo4.cjs.map} +1 -1
- package/dist/{run-CIkCVMy_.js → run-Wgn9nFDE.js} +2 -2
- package/dist/{run-CIkCVMy_.js.map → run-Wgn9nFDE.js.map} +1 -1
- package/dist/{studio-BQV9CeZK.cjs → studio-Cj52hx3a.cjs} +6 -5
- package/dist/studio-Cj52hx3a.cjs.map +1 -0
- package/dist/{studio-DUNPmQ5V.js → studio-CpV4eXj9.js} +6 -5
- package/dist/studio-CpV4eXj9.js.map +1 -0
- package/package.json +7 -7
- package/dist/generate-CCjNi8-B.cjs.map +0 -1
- package/dist/generate-DnOsvKdA.js.map +0 -1
- package/dist/init-BEZE-TU-.cjs.map +0 -1
- package/dist/init-DFBbp97w.js.map +0 -1
- package/dist/package-DYdGw7-C.js +0 -6
- package/dist/package-DYdGw7-C.js.map +0 -1
- package/dist/package-DgNWnCoo.cjs.map +0 -1
- package/dist/studio-BQV9CeZK.cjs.map +0 -1
- package/dist/studio-DUNPmQ5V.js.map +0 -1
package/README.md
CHANGED
|
@@ -103,15 +103,15 @@ npx kubb generate
|
|
|
103
103
|
|
|
104
104
|
#### Options
|
|
105
105
|
|
|
106
|
-
| Flag
|
|
107
|
-
|
|
|
108
|
-
| `[input]`
|
|
109
|
-
| `--config <path>`
|
|
110
|
-
| `--
|
|
111
|
-
| `--watch`
|
|
112
|
-
| `--verbose`
|
|
113
|
-
| `--silent`
|
|
114
|
-
| `--reporter <names>`
|
|
106
|
+
| Flag | Short | Type | Default | Description |
|
|
107
|
+
| --------------------- | ----- | ------- | ------- | ----------------------------------------------------------------------------------------------------------- |
|
|
108
|
+
| `[input]` | | string | | OpenAPI file path or URL that overrides `input` in the config |
|
|
109
|
+
| `--config <path>` | `-c` | string | | Path to the Kubb config file |
|
|
110
|
+
| `--log-level <level>` | `-l` | string | `info` | Log level: `silent`, `info`, or `verbose` |
|
|
111
|
+
| `--watch` | `-w` | boolean | `false` | Re-generate whenever the input file changes |
|
|
112
|
+
| `--verbose` | `-v` | boolean | `false` | Override log level to `verbose` |
|
|
113
|
+
| `--silent` | `-s` | boolean | `false` | Override log level to `silent` |
|
|
114
|
+
| `--reporter <names>` | | string | `cli` | Reporters that render the run, comma-separated: `cli`, `json`, `file`, `html`. Overrides `config.reporters` |
|
|
115
115
|
|
|
116
116
|
#### Examples
|
|
117
117
|
|
|
@@ -133,6 +133,9 @@ npx kubb generate --verbose
|
|
|
133
133
|
|
|
134
134
|
# Write a JSON run report alongside the CLI output
|
|
135
135
|
npx kubb generate --reporter cli,json
|
|
136
|
+
|
|
137
|
+
# Write an HTML run report
|
|
138
|
+
npx kubb generate --reporter html
|
|
136
139
|
```
|
|
137
140
|
|
|
138
141
|
---
|
|
@@ -154,7 +157,7 @@ stores the agent token in `~/.kubb/credentials.json` at mode `0600`. Later runs
|
|
|
154
157
|
|
|
155
158
|
The connection is read-only by default. On the first connect to a project the CLI asks yes/no
|
|
156
159
|
for each permission separately: writing generated files, editing `kubb.config.ts`, accepting a
|
|
157
|
-
spec from Studio, and running the formatter, linter, or `postGenerate`. Each `--allow
|
|
160
|
+
spec from Studio, and running the formatter, linter, or `postGenerate`. Each `--allow-*` flag
|
|
158
161
|
skips the question for that one permission.
|
|
159
162
|
|
|
160
163
|
#### Arguments
|
|
@@ -165,16 +168,19 @@ skips the question for that one permission.
|
|
|
165
168
|
|
|
166
169
|
#### Options
|
|
167
170
|
|
|
168
|
-
| Flag
|
|
169
|
-
|
|
|
170
|
-
| `--config <path>`
|
|
171
|
-
| `--url <url>`
|
|
172
|
-
| `--
|
|
173
|
-
| `--
|
|
174
|
-
| `--
|
|
175
|
-
| `--
|
|
176
|
-
| `--no-open`
|
|
177
|
-
| `--
|
|
171
|
+
| Flag | Short | Type | Default | Description |
|
|
172
|
+
| --------------------- | ----- | ------- | --------------------- | --------------------------------------------------------------------------------------------- |
|
|
173
|
+
| `--config <path>` | `-c` | string | | Path to the Kubb config file |
|
|
174
|
+
| `--url <url>` | | string | `https://kubb.studio` | Base URL of the Kubb Studio instance |
|
|
175
|
+
| `--allow-write` | | boolean | `false` | Write generated files to disk. Asked for once per project when omitted |
|
|
176
|
+
| `--allow-config-edit` | | boolean | `false` | Edit plugin options in `kubb.config.ts`. Asked for once per project when omitted |
|
|
177
|
+
| `--allow-input` | | boolean | `false` | Generate from a spec sent by Studio. Asked for once per project when omitted |
|
|
178
|
+
| `--allow-exec` | | boolean | `false` | Run the formatter, the linter, and `output.postGenerate`. Asked once per project when omitted |
|
|
179
|
+
| `--no-open` | | boolean | | Do not open the approval page in a browser while pairing |
|
|
180
|
+
| `--log-level <level>` | `-l` | string | `info` | Log level: `silent`, `info`, or `verbose` |
|
|
181
|
+
|
|
182
|
+
The old camelCase spelling of a flag (`--allowWrite`, `--logLevel`, `--dryRun`) still works and
|
|
183
|
+
prints a deprecation warning on stderr. Support for it will be removed in a future major version.
|
|
178
184
|
|
|
179
185
|
#### Examples
|
|
180
186
|
|
|
@@ -183,7 +189,7 @@ skips the question for that one permission.
|
|
|
183
189
|
npx kubb studio
|
|
184
190
|
|
|
185
191
|
# Let Studio write generated files to disk
|
|
186
|
-
npx kubb studio --
|
|
192
|
+
npx kubb studio --allow-write
|
|
187
193
|
|
|
188
194
|
# Pair without connecting
|
|
189
195
|
npx kubb studio login
|
|
@@ -198,8 +204,6 @@ npx kubb studio logout
|
|
|
198
204
|
npx kubb studio --url http://localhost:3000
|
|
199
205
|
```
|
|
200
206
|
|
|
201
|
-
Flags are camelCase. `--allow-write` is not recognized and is silently ignored.
|
|
202
|
-
|
|
203
207
|
---
|
|
204
208
|
|
|
205
209
|
### `kubb validate`
|
|
@@ -17,7 +17,7 @@ function parseReporters(value) {
|
|
|
17
17
|
return names;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--
|
|
20
|
+
* Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.
|
|
21
21
|
*/
|
|
22
22
|
function resolveLogLevel({ verbose, silent, logLevel }) {
|
|
23
23
|
if (verbose) return "verbose";
|
|
@@ -32,11 +32,13 @@ const command = defineWithTypes()({
|
|
|
32
32
|
"kubb generate ./openapi.yaml # generate from this spec instead of the config input",
|
|
33
33
|
"kubb generate --config kubb.config.ts",
|
|
34
34
|
"kubb generate --watch # regenerate whenever the spec changes",
|
|
35
|
-
"kubb generate --
|
|
35
|
+
"kubb generate --dry-run # preview the run without writing files",
|
|
36
|
+
"kubb generate --reporter html # write an HTML run report",
|
|
36
37
|
"kubb studio # connect this project to Kubb Studio and generate from the browser",
|
|
37
|
-
"kubb studio --
|
|
38
|
+
"kubb studio --allow-write # let Studio write the generated files to disk",
|
|
38
39
|
"kubb studio login # pair this machine with Studio without connecting"
|
|
39
40
|
].join("\n"),
|
|
41
|
+
toKebab: true,
|
|
40
42
|
args: {
|
|
41
43
|
input: {
|
|
42
44
|
type: "positional",
|
|
@@ -78,7 +80,7 @@ const command = defineWithTypes()({
|
|
|
78
80
|
},
|
|
79
81
|
reporter: {
|
|
80
82
|
type: "custom",
|
|
81
|
-
description: "Reporters that render the run,
|
|
83
|
+
description: "Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters",
|
|
82
84
|
metavar: "cli|json|file|html",
|
|
83
85
|
parse: parseReporters
|
|
84
86
|
}
|
|
@@ -86,7 +88,7 @@ const command = defineWithTypes()({
|
|
|
86
88
|
async run(ctx) {
|
|
87
89
|
const { values } = ctx;
|
|
88
90
|
const logLevel = resolveLogLevel(values);
|
|
89
|
-
const { run } = await import("./run-
|
|
91
|
+
const { run } = await import("./run-Bq7Mqn5d.js");
|
|
90
92
|
await run({
|
|
91
93
|
input: values.input,
|
|
92
94
|
configPath: values.config,
|
|
@@ -100,4 +102,4 @@ const command = defineWithTypes()({
|
|
|
100
102
|
//#endregion
|
|
101
103
|
export { command };
|
|
102
104
|
|
|
103
|
-
//# sourceMappingURL=generate-
|
|
105
|
+
//# sourceMappingURL=generate-CuOh9cQF.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-CuOh9cQF.js","names":[],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { dryRunId } from '../gunshiDryRun.ts'\nimport type { DryRunExtensions } from '../gunshiDryRun.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file', 'html']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file, html (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dry-run # preview the run without writing files',\n 'kubb generate --reporter html # write an HTML run report',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allow-write # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\n'),\n toKebab: true,\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode: watches an input file for changes, or polls an input URL',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file|html',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n"],"mappings":";;;;AAKA,MAAM,iBAAsC;CAAC;CAAO;CAAQ;CAAQ;AAAM;;;;AAK1E,SAAS,eAAe,OAAoC;CAC1D,MAAM,QAAQ,MACX,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO;CAEjB,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,eAAe,SAAS,IAAoB,GAC/C,MAAM,IAAI,MAAM,8CAA8C,KAAK,GAAG;CAI1E,OAAO;AACT;;;;AAKA,SAAS,gBAAgB,EAAE,SAAS,QAAQ,YAA6E;CACvH,IAAI,SAAS,OAAO;CACpB,IAAI,QAAQ,OAAO;CACnB,OAAO;AACT;AAEA,MAAa,UAAU,gBAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,SAAS;CACT,MAAM;EACJ,OAAO;GACL,MAAM;GACN,UAAU;GACV,aAAa;EACf;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,SAAS;IAAC;IAAU;IAAQ;GAAS;GACrC,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aAAa;GACb,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,SAAS;GACT,OAAO;EACT;CACF;CACA,MAAM,IAAI,KAAK;EACb,MAAM,EAAE,WAAW;EACnB,MAAM,WAAW,gBAAgB,MAAM;EACvC,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,OAAO,OAAO;GACd,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACd,WAAW,OAAO;GAClB,QAAQ,IAAI,WAAW,SAAS,CAAC;EACnC,CAAC;CACH;AACF,CAAC"}
|
|
@@ -17,7 +17,7 @@ function parseReporters(value) {
|
|
|
17
17
|
return names;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
|
-
* Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--
|
|
20
|
+
* Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.
|
|
21
21
|
*/
|
|
22
22
|
function resolveLogLevel({ verbose, silent, logLevel }) {
|
|
23
23
|
if (verbose) return "verbose";
|
|
@@ -32,11 +32,13 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
32
32
|
"kubb generate ./openapi.yaml # generate from this spec instead of the config input",
|
|
33
33
|
"kubb generate --config kubb.config.ts",
|
|
34
34
|
"kubb generate --watch # regenerate whenever the spec changes",
|
|
35
|
-
"kubb generate --
|
|
35
|
+
"kubb generate --dry-run # preview the run without writing files",
|
|
36
|
+
"kubb generate --reporter html # write an HTML run report",
|
|
36
37
|
"kubb studio # connect this project to Kubb Studio and generate from the browser",
|
|
37
|
-
"kubb studio --
|
|
38
|
+
"kubb studio --allow-write # let Studio write the generated files to disk",
|
|
38
39
|
"kubb studio login # pair this machine with Studio without connecting"
|
|
39
40
|
].join("\n"),
|
|
41
|
+
toKebab: true,
|
|
40
42
|
args: {
|
|
41
43
|
input: {
|
|
42
44
|
type: "positional",
|
|
@@ -78,7 +80,7 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
78
80
|
},
|
|
79
81
|
reporter: {
|
|
80
82
|
type: "custom",
|
|
81
|
-
description: "Reporters that render the run,
|
|
83
|
+
description: "Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters",
|
|
82
84
|
metavar: "cli|json|file|html",
|
|
83
85
|
parse: parseReporters
|
|
84
86
|
}
|
|
@@ -86,7 +88,7 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
86
88
|
async run(ctx) {
|
|
87
89
|
const { values } = ctx;
|
|
88
90
|
const logLevel = resolveLogLevel(values);
|
|
89
|
-
const { run } = await Promise.resolve().then(() => require("./run-
|
|
91
|
+
const { run } = await Promise.resolve().then(() => require("./run-BKJr0PQx.cjs"));
|
|
90
92
|
await run({
|
|
91
93
|
input: values.input,
|
|
92
94
|
configPath: values.config,
|
|
@@ -100,4 +102,4 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
100
102
|
//#endregion
|
|
101
103
|
exports.command = command;
|
|
102
104
|
|
|
103
|
-
//# sourceMappingURL=generate-
|
|
105
|
+
//# sourceMappingURL=generate-DtsFV9_7.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-DtsFV9_7.cjs","names":["defineWithTypes","dryRunId"],"sources":["../src/commands/generate.ts"],"sourcesContent":["import { defineWithTypes } from 'gunshi'\nimport type { ReporterName } from '@kubb/core'\nimport { dryRunId } from '../gunshiDryRun.ts'\nimport type { DryRunExtensions } from '../gunshiDryRun.ts'\n\nconst REPORTER_NAMES: Array<ReporterName> = ['cli', 'json', 'file', 'html']\n\n/**\n * Splits and validates the comma-separated `--reporter` value against the known reporter names.\n */\nfunction parseReporters(value: string): Array<ReporterName> {\n const names = value\n .split(',')\n .map((name) => name.trim())\n .filter(Boolean)\n\n for (const name of names) {\n if (!REPORTER_NAMES.includes(name as ReporterName)) {\n throw new Error(`must be one of cli, json, file, html (got \"${name}\")`)\n }\n }\n\n return names as Array<ReporterName>\n}\n\n/**\n * Resolves the effective log level, letting the `--verbose` and `--silent` flags win over `--log-level`.\n */\nfunction resolveLogLevel({ verbose, silent, logLevel }: { verbose: boolean; silent: boolean; logLevel: string }): string {\n if (verbose) return 'verbose'\n if (silent) return 'silent'\n return logLevel\n}\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'generate',\n description:\n 'Generate TypeScript types, API clients, React Query hooks, Zod schemas, and more from an OpenAPI specification. Reads kubb.config.ts by default. Pass an OpenAPI file path as the first argument to override the input without editing the config.',\n examples: [\n 'kubb generate # generate from kubb.config.ts',\n 'kubb generate ./openapi.yaml # generate from this spec instead of the config input',\n 'kubb generate --config kubb.config.ts',\n 'kubb generate --watch # regenerate whenever the spec changes',\n 'kubb generate --dry-run # preview the run without writing files',\n 'kubb generate --reporter html # write an HTML run report',\n 'kubb studio # connect this project to Kubb Studio and generate from the browser',\n 'kubb studio --allow-write # let Studio write the generated files to disk',\n 'kubb studio login # pair this machine with Studio without connecting',\n ].join('\\n'),\n toKebab: true,\n args: {\n input: {\n type: 'positional',\n required: false,\n description: 'Path to the OpenAPI specification, overriding the config',\n },\n config: {\n type: 'string',\n description: 'Path to the Kubb config',\n short: 'c',\n },\n logLevel: {\n type: 'enum',\n choices: ['silent', 'info', 'verbose'] as const,\n description: 'Info, silent or verbose',\n short: 'l',\n default: 'info',\n },\n watch: {\n type: 'boolean',\n description: 'Watch mode: watches an input file for changes, or polls an input URL',\n short: 'w',\n default: false,\n },\n verbose: {\n type: 'boolean',\n description: 'Override logLevel to verbose',\n default: false,\n },\n silent: {\n type: 'boolean',\n description: 'Override logLevel to silent',\n short: 's',\n default: false,\n },\n reporter: {\n type: 'custom',\n description: 'Reporters that render the run: cli, json, file, html. Comma-separated. Overrides config.reporters',\n metavar: 'cli|json|file|html',\n parse: parseReporters,\n },\n },\n async run(ctx) {\n const { values } = ctx\n const logLevel = resolveLogLevel(values)\n const { run } = await import('../runners/generate/run.ts')\n\n await run({\n input: values.input,\n configPath: values.config,\n logLevel,\n watch: values.watch,\n reporters: values.reporter,\n dryRun: ctx.extensions[dryRunId].enabled,\n })\n },\n})\n"],"mappings":";;;;AAKA,MAAM,iBAAsC;CAAC;CAAO;CAAQ;CAAQ;AAAM;;;;AAK1E,SAAS,eAAe,OAAoC;CAC1D,MAAM,QAAQ,MACX,MAAM,GAAG,CAAC,CACV,KAAK,SAAS,KAAK,KAAK,CAAC,CAAC,CAC1B,OAAO,OAAO;CAEjB,KAAK,MAAM,QAAQ,OACjB,IAAI,CAAC,eAAe,SAAS,IAAoB,GAC/C,MAAM,IAAI,MAAM,8CAA8C,KAAK,GAAG;CAI1E,OAAO;AACT;;;;AAKA,SAAS,gBAAgB,EAAE,SAAS,QAAQ,YAA6E;CACvH,IAAI,SAAS,OAAO;CACpB,IAAI,QAAQ,OAAO;CACnB,OAAO;AACT;AAEA,MAAa,WAAA,GAAUA,OAAAA,gBAAAA,CAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aACE;CACF,UAAU;EACR;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACF,CAAC,CAAC,KAAK,IAAI;CACX,SAAS;CACT,MAAM;EACJ,OAAO;GACL,MAAM;GACN,UAAU;GACV,aAAa;EACf;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;EACT;EACA,UAAU;GACR,MAAM;GACN,SAAS;IAAC;IAAU;IAAQ;GAAS;GACrC,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,OAAO;GACL,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,SAAS;GACP,MAAM;GACN,aAAa;GACb,SAAS;EACX;EACA,QAAQ;GACN,MAAM;GACN,aAAa;GACb,OAAO;GACP,SAAS;EACX;EACA,UAAU;GACR,MAAM;GACN,aAAa;GACb,SAAS;GACT,OAAO;EACT;CACF;CACA,MAAM,IAAI,KAAK;EACb,MAAM,EAAE,WAAW;EACnB,MAAM,WAAW,gBAAgB,MAAM;EACvC,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,OAAO,OAAO;GACd,YAAY,OAAO;GACnB;GACA,OAAO,OAAO;GACd,WAAW,OAAO;GAClB,QAAQ,IAAI,WAAWC,sBAAAA,SAAS,CAAC;EACnC,CAAC;CACH;AACF,CAAC"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
const require_rolldown_runtime = require("./rolldown-runtime-qbf5tadS.cjs");
|
|
3
3
|
const require_Telemetry = require("./Telemetry-CvHQevSK.cjs");
|
|
4
|
-
const require_package = require("./package-
|
|
4
|
+
const require_package = require("./package-VYHX-Cpv.cjs");
|
|
5
5
|
let node_util = require("node:util");
|
|
6
6
|
let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
|
|
7
7
|
_gunshi_plugin_dryrun = require_rolldown_runtime.__toESM(_gunshi_plugin_dryrun, 1);
|
|
8
8
|
let gunshi = require("gunshi");
|
|
9
|
+
//#region src/deprecatedFlags.ts
|
|
10
|
+
/**
|
|
11
|
+
* Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its
|
|
12
|
+
* replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.
|
|
13
|
+
*/
|
|
14
|
+
const DEPRECATED_FLAGS = {
|
|
15
|
+
allowWrite: "allow-write",
|
|
16
|
+
allowConfigEdit: "allow-config-edit",
|
|
17
|
+
allowInput: "allow-input",
|
|
18
|
+
allowExec: "allow-exec",
|
|
19
|
+
logLevel: "log-level",
|
|
20
|
+
dryRun: "dry-run",
|
|
21
|
+
packageVersion: "package-version"
|
|
22
|
+
};
|
|
23
|
+
const FLAG_PATTERN = /^--([a-zA-Z][\w-]*)(=.*)?$/;
|
|
24
|
+
/**
|
|
25
|
+
* Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a
|
|
26
|
+
* script written against the old flag names keeps working during the deprecation window instead
|
|
27
|
+
* of failing with an unknown-option error.
|
|
28
|
+
*/
|
|
29
|
+
function resolveDeprecatedFlags(args) {
|
|
30
|
+
return args.map((arg) => {
|
|
31
|
+
const match = FLAG_PATTERN.exec(arg);
|
|
32
|
+
const name = match?.[1];
|
|
33
|
+
const replacement = name ? DEPRECATED_FLAGS[name] : void 0;
|
|
34
|
+
if (!name || !replacement) return arg;
|
|
35
|
+
console.error(`${(0, node_util.styleText)("yellow", "Warning:")} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`);
|
|
36
|
+
return `--${replacement}${match?.[2] ?? ""}`;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
9
40
|
//#region src/index.ts
|
|
10
41
|
/**
|
|
11
42
|
* Strips the leading executable + script entries when `process.argv` is passed directly.
|
|
@@ -30,17 +61,17 @@ function isSnapshotJson(args) {
|
|
|
30
61
|
* `generate` when no command is given.
|
|
31
62
|
*/
|
|
32
63
|
async function run(argv = process.argv) {
|
|
33
|
-
const args = stripExecArgs(argv);
|
|
64
|
+
const args = resolveDeprecatedFlags(stripExecArgs(argv));
|
|
34
65
|
const isQuietFlag = args.some((arg) => require_Telemetry.QUIET_FLAGS.has(arg)) || isSnapshotJson(args);
|
|
35
66
|
if (!require_Telemetry.isDisabled() && !isQuietFlag) console.log(`${(0, node_util.styleText)("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${(0, node_util.styleText)("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
|
|
36
|
-
const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-
|
|
37
|
-
const { command: initCommand } = await Promise.resolve().then(() => require("./init-
|
|
67
|
+
const { command: generateCommand } = await Promise.resolve().then(() => require("./generate-DtsFV9_7.cjs"));
|
|
68
|
+
const { command: initCommand } = await Promise.resolve().then(() => require("./init-DlefULI4.cjs"));
|
|
38
69
|
const { definition: validateDefinition } = await Promise.resolve().then(() => require("./validate-BcB0tFQ6.cjs"));
|
|
39
|
-
const validateCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-
|
|
70
|
+
const validateCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-CKI6slB-.cjs"))).runner, validateDefinition);
|
|
40
71
|
const { definition: mcpDefinition } = await Promise.resolve().then(() => require("./mcp-B3B-rE7W.cjs"));
|
|
41
|
-
const mcpCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-
|
|
42
|
-
const { definition: studioDefinition } = await Promise.resolve().then(() => require("./studio-
|
|
43
|
-
const studioCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-
|
|
72
|
+
const mcpCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-Pdr1Evo4.cjs"))).runner, mcpDefinition);
|
|
73
|
+
const { definition: studioDefinition } = await Promise.resolve().then(() => require("./studio-Cj52hx3a.cjs"));
|
|
74
|
+
const studioCommand = (0, gunshi.lazy)(async () => (await Promise.resolve().then(() => require("./run-DCd70CQu.cjs"))).runner, studioDefinition);
|
|
44
75
|
await (0, gunshi.cli)(args, generateCommand, {
|
|
45
76
|
name: "kubb",
|
|
46
77
|
version: require_package.version,
|
|
@@ -54,7 +85,7 @@ async function run(argv = process.argv) {
|
|
|
54
85
|
},
|
|
55
86
|
fallbackToEntry: true,
|
|
56
87
|
strict: true,
|
|
57
|
-
plugins: [(0, _gunshi_plugin_dryrun.default)()],
|
|
88
|
+
plugins: [(0, _gunshi_plugin_dryrun.default)({ name: "dry-run" })],
|
|
58
89
|
...isSnapshotJson(args) ? { renderHeader: null } : {},
|
|
59
90
|
onErrorCommand: async (_ctx, error) => {
|
|
60
91
|
process.exitCode = 1;
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["QUIET_FLAGS","isTelemetryDisabled","styleText","lazy","cli","dryrun"],"sources":["../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli, lazy } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Whether this run is `kubb studio snapshot --json`, which must print exactly one JSON object on\n * stdout so a script can parse it. The telemetry notice and gunshi's own header both write to\n * stdout by default, so both are suppressed for this one invocation shape.\n */\nfunction isSnapshotJson(args: Array<string>): boolean {\n return args[0] === 'studio' && args[1] === 'snapshot' && args.includes('--json')\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, studio, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const args = stripExecArgs(argv)\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg)) || isSnapshotJson(args)\n\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n // Each runner pulls in an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio), so it\n // loads only when its command runs.\n const { definition: validateDefinition } = await import('./commands/validate.ts')\n const validateCommand = lazy(async () => (await import('./runners/validate/run.ts')).runner, validateDefinition)\n const { definition: mcpDefinition } = await import('./commands/mcp.ts')\n const mcpCommand = lazy(async () => (await import('./runners/mcp/run.ts')).runner, mcpDefinition)\n const { definition: studioDefinition } = await import('./commands/studio.ts')\n const studioCommand = lazy(async () => (await import('./runners/studio/run.ts')).runner, studioDefinition)\n\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun()],\n // `snapshot --json` owns stdout: gunshi's default header would otherwise print ahead of it.\n ...(isSnapshotJson(args) ? { renderHeader: null } : {}),\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["styleText","QUIET_FLAGS","isTelemetryDisabled","styleText","lazy","cli","dryrun"],"sources":["../src/deprecatedFlags.ts","../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\n\n/**\n * Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its\n * replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.\n */\nconst DEPRECATED_FLAGS: Record<string, string> = {\n allowWrite: 'allow-write',\n allowConfigEdit: 'allow-config-edit',\n allowInput: 'allow-input',\n allowExec: 'allow-exec',\n logLevel: 'log-level',\n dryRun: 'dry-run',\n packageVersion: 'package-version',\n}\n\nconst FLAG_PATTERN = /^--([a-zA-Z][\\w-]*)(=.*)?$/\n\n/**\n * Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a\n * script written against the old flag names keeps working during the deprecation window instead\n * of failing with an unknown-option error.\n */\nexport function resolveDeprecatedFlags(args: Array<string>): Array<string> {\n return args.map((arg) => {\n const match = FLAG_PATTERN.exec(arg)\n const name = match?.[1]\n const replacement = name ? DEPRECATED_FLAGS[name] : undefined\n\n if (!name || !replacement) {\n return arg\n }\n\n console.error(\n `${styleText('yellow', 'Warning:')} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`,\n )\n\n return `--${replacement}${match?.[2] ?? ''}`\n })\n}\n","import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli, lazy } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\nimport { resolveDeprecatedFlags } from './deprecatedFlags.ts'\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Whether this run is `kubb studio snapshot --json`, which must print exactly one JSON object on\n * stdout so a script can parse it. The telemetry notice and gunshi's own header both write to\n * stdout by default, so both are suppressed for this one invocation shape.\n */\nfunction isSnapshotJson(args: Array<string>): boolean {\n return args[0] === 'studio' && args[1] === 'snapshot' && args.includes('--json')\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, studio, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const args = resolveDeprecatedFlags(stripExecArgs(argv))\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg)) || isSnapshotJson(args)\n\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n // Each runner pulls in an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio), so it\n // loads only when its command runs.\n const { definition: validateDefinition } = await import('./commands/validate.ts')\n const validateCommand = lazy(async () => (await import('./runners/validate/run.ts')).runner, validateDefinition)\n const { definition: mcpDefinition } = await import('./commands/mcp.ts')\n const mcpCommand = lazy(async () => (await import('./runners/mcp/run.ts')).runner, mcpDefinition)\n const { definition: studioDefinition } = await import('./commands/studio.ts')\n const studioCommand = lazy(async () => (await import('./runners/studio/run.ts')).runner, studioDefinition)\n\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun({ name: 'dry-run' })],\n // `snapshot --json` owns stdout: gunshi's default header would otherwise print ahead of it.\n ...(isSnapshotJson(args) ? { renderHeader: null } : {}),\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;;;;;;;;AAMA,MAAM,mBAA2C;CAC/C,YAAY;CACZ,iBAAiB;CACjB,YAAY;CACZ,WAAW;CACX,UAAU;CACV,QAAQ;CACR,gBAAgB;AAClB;AAEA,MAAM,eAAe;;;;;;AAOrB,SAAgB,uBAAuB,MAAoC;CACzE,OAAO,KAAK,KAAK,QAAQ;EACvB,MAAM,QAAQ,aAAa,KAAK,GAAG;EACnC,MAAM,OAAO,QAAQ;EACrB,MAAM,cAAc,OAAO,iBAAiB,QAAQ,KAAA;EAEpD,IAAI,CAAC,QAAQ,CAAC,aACZ,OAAO;EAGT,QAAQ,MACN,IAAA,GAAGA,UAAAA,UAAAA,CAAU,UAAU,UAAU,EAAE,KAAK,KAAK,wBAAwB,YAAY,cAAc,KAAK,4CACtG;EAEA,OAAO,KAAK,cAAc,QAAQ,MAAM;CAC1C,CAAC;AACH;;;;;;;;AC1BA,SAAS,cAAc,MAAoC;CACzD,MAAM,4BAA4B,KAAK,EAAE,EAAE,SAAS,GAAG,KAAK,KAAK,EAAE,EAAE,SAAS,IAAI,MAAM;CACxF,OAAO,KAAK,UAAU,KAAK,2BAA2B,KAAK,MAAM,CAAC,IAAI;AACxE;;;;;;AAOA,SAAS,eAAe,MAA8B;CACpD,OAAO,KAAK,OAAO,YAAY,KAAK,OAAO,cAAc,KAAK,SAAS,QAAQ;AACjF;;;;;;AAOA,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,OAAO,uBAAuB,cAAc,IAAI,CAAC;CACvD,MAAM,cAAc,KAAK,MAAM,QAAQC,kBAAAA,YAAY,IAAI,GAAG,CAAC,KAAK,eAAe,IAAI;CAEnF,IAAI,CAACC,kBAAAA,WAAoB,KAAK,CAAC,aAC7B,QAAQ,IACN,IAAA,GAAGC,UAAAA,UAAAA,CAAU,UAAU,SAAS,EAAE,wIAAA,GAAuIA,UAAAA,UAAAA,CAAU,QAAQ,0BAA0B,EAAE,IACzN;CAGF,MAAM,EAAE,SAAS,oBAAoB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,yBAAA,CAAA;CAC3C,MAAM,EAAE,SAAS,gBAAgB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,qBAAA,CAAA;CAGvC,MAAM,EAAE,YAAY,uBAAuB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,yBAAA,CAAA;CACjD,MAAM,mBAAA,GAAkBC,OAAAA,KAAAA,CAAK,aAAa,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA,EAAA,CAAqC,QAAQ,kBAAkB;CAC/G,MAAM,EAAE,YAAY,kBAAkB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;CAC5C,MAAM,cAAA,GAAaA,OAAAA,KAAAA,CAAK,aAAa,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA,EAAA,CAAgC,QAAQ,aAAa;CAChG,MAAM,EAAE,YAAY,qBAAqB,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,uBAAA,CAAA;CAC/C,MAAM,iBAAA,GAAgBA,OAAAA,KAAAA,CAAK,aAAa,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA,EAAA,CAAmC,QAAQ,gBAAgB;CAEzG,OAAA,GAAMC,OAAAA,IAAAA,CAAI,MAAM,iBAAiB;EAC/B,MAAM;EACN,SAAA,gBAAA;EAGA,aAAa;EACb,aAAa;GACX,UAAU;GACV,MAAM;GACN,UAAU;GACV,KAAK;GACL,QAAQ;EACV;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,EAAA,GAACC,sBAAAA,QAAAA,CAAO,EAAE,MAAM,UAAU,CAAC,CAAC;EAErC,GAAI,eAAe,IAAI,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;EACrD,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,40 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
2
|
import { a as QUIET_FLAGS, n as isDisabled } from "./Telemetry-CJcQkQOT.js";
|
|
3
|
-
import { t as version } from "./package-
|
|
3
|
+
import { t as version } from "./package-C8jSgTtL.js";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import dryrun from "@gunshi/plugin-dryrun";
|
|
6
6
|
import { cli, lazy } from "gunshi";
|
|
7
|
+
//#region src/deprecatedFlags.ts
|
|
8
|
+
/**
|
|
9
|
+
* Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its
|
|
10
|
+
* replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.
|
|
11
|
+
*/
|
|
12
|
+
const DEPRECATED_FLAGS = {
|
|
13
|
+
allowWrite: "allow-write",
|
|
14
|
+
allowConfigEdit: "allow-config-edit",
|
|
15
|
+
allowInput: "allow-input",
|
|
16
|
+
allowExec: "allow-exec",
|
|
17
|
+
logLevel: "log-level",
|
|
18
|
+
dryRun: "dry-run",
|
|
19
|
+
packageVersion: "package-version"
|
|
20
|
+
};
|
|
21
|
+
const FLAG_PATTERN = /^--([a-zA-Z][\w-]*)(=.*)?$/;
|
|
22
|
+
/**
|
|
23
|
+
* Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a
|
|
24
|
+
* script written against the old flag names keeps working during the deprecation window instead
|
|
25
|
+
* of failing with an unknown-option error.
|
|
26
|
+
*/
|
|
27
|
+
function resolveDeprecatedFlags(args) {
|
|
28
|
+
return args.map((arg) => {
|
|
29
|
+
const match = FLAG_PATTERN.exec(arg);
|
|
30
|
+
const name = match?.[1];
|
|
31
|
+
const replacement = name ? DEPRECATED_FLAGS[name] : void 0;
|
|
32
|
+
if (!name || !replacement) return arg;
|
|
33
|
+
console.error(`${styleText("yellow", "Warning:")} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`);
|
|
34
|
+
return `--${replacement}${match?.[2] ?? ""}`;
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
7
38
|
//#region src/index.ts
|
|
8
39
|
/**
|
|
9
40
|
* Strips the leading executable + script entries when `process.argv` is passed directly.
|
|
@@ -28,17 +59,17 @@ function isSnapshotJson(args) {
|
|
|
28
59
|
* `generate` when no command is given.
|
|
29
60
|
*/
|
|
30
61
|
async function run(argv = process.argv) {
|
|
31
|
-
const args = stripExecArgs(argv);
|
|
62
|
+
const args = resolveDeprecatedFlags(stripExecArgs(argv));
|
|
32
63
|
const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg)) || isSnapshotJson(args);
|
|
33
64
|
if (!isDisabled() && !isQuietFlag) console.log(`${styleText("yellow", "Notice:")} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \nTo disable, set ${styleText("cyan", "KUBB_DISABLE_TELEMETRY=1")}.\n`);
|
|
34
|
-
const { command: generateCommand } = await import("./generate-
|
|
35
|
-
const { command: initCommand } = await import("./init-
|
|
65
|
+
const { command: generateCommand } = await import("./generate-CuOh9cQF.js");
|
|
66
|
+
const { command: initCommand } = await import("./init-Mfgx1m1H.js");
|
|
36
67
|
const { definition: validateDefinition } = await import("./validate-QpkCbIFJ.js");
|
|
37
|
-
const validateCommand = lazy(async () => (await import("./run-
|
|
68
|
+
const validateCommand = lazy(async () => (await import("./run-CUcyZyr4.js")).runner, validateDefinition);
|
|
38
69
|
const { definition: mcpDefinition } = await import("./mcp-B-GxGgVr.js");
|
|
39
|
-
const mcpCommand = lazy(async () => (await import("./run-
|
|
40
|
-
const { definition: studioDefinition } = await import("./studio-
|
|
41
|
-
const studioCommand = lazy(async () => (await import("./run-
|
|
70
|
+
const mcpCommand = lazy(async () => (await import("./run-Wgn9nFDE.js")).runner, mcpDefinition);
|
|
71
|
+
const { definition: studioDefinition } = await import("./studio-CpV4eXj9.js");
|
|
72
|
+
const studioCommand = lazy(async () => (await import("./run-Cf5cTwV7.js")).runner, studioDefinition);
|
|
42
73
|
await cli(args, generateCommand, {
|
|
43
74
|
name: "kubb",
|
|
44
75
|
version,
|
|
@@ -52,7 +83,7 @@ async function run(argv = process.argv) {
|
|
|
52
83
|
},
|
|
53
84
|
fallbackToEntry: true,
|
|
54
85
|
strict: true,
|
|
55
|
-
plugins: [dryrun()],
|
|
86
|
+
plugins: [dryrun({ name: "dry-run" })],
|
|
56
87
|
...isSnapshotJson(args) ? { renderHeader: null } : {},
|
|
57
88
|
onErrorCommand: async (_ctx, error) => {
|
|
58
89
|
process.exitCode = 1;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isTelemetryDisabled"],"sources":["../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli, lazy } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Whether this run is `kubb studio snapshot --json`, which must print exactly one JSON object on\n * stdout so a script can parse it. The telemetry notice and gunshi's own header both write to\n * stdout by default, so both are suppressed for this one invocation shape.\n */\nfunction isSnapshotJson(args: Array<string>): boolean {\n return args[0] === 'studio' && args[1] === 'snapshot' && args.includes('--json')\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, studio, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const args = stripExecArgs(argv)\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg)) || isSnapshotJson(args)\n\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n // Each runner pulls in an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio), so it\n // loads only when its command runs.\n const { definition: validateDefinition } = await import('./commands/validate.ts')\n const validateCommand = lazy(async () => (await import('./runners/validate/run.ts')).runner, validateDefinition)\n const { definition: mcpDefinition } = await import('./commands/mcp.ts')\n const mcpCommand = lazy(async () => (await import('./runners/mcp/run.ts')).runner, mcpDefinition)\n const { definition: studioDefinition } = await import('./commands/studio.ts')\n const studioCommand = lazy(async () => (await import('./runners/studio/run.ts')).runner, studioDefinition)\n\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun()],\n // `snapshot --json` owns stdout: gunshi's default header would otherwise print ahead of it.\n ...(isSnapshotJson(args) ? { renderHeader: null } : {}),\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":["isTelemetryDisabled"],"sources":["../src/deprecatedFlags.ts","../src/index.ts"],"sourcesContent":["import { styleText } from 'node:util'\n\n/**\n * Maps each camelCase flag removed in favor of kebab-case (kubb-labs/kubb#4046) to its\n * replacement. Drop this table, and the rewrite it drives, once the deprecation window ends.\n */\nconst DEPRECATED_FLAGS: Record<string, string> = {\n allowWrite: 'allow-write',\n allowConfigEdit: 'allow-config-edit',\n allowInput: 'allow-input',\n allowExec: 'allow-exec',\n logLevel: 'log-level',\n dryRun: 'dry-run',\n packageVersion: 'package-version',\n}\n\nconst FLAG_PATTERN = /^--([a-zA-Z][\\w-]*)(=.*)?$/\n\n/**\n * Rewrites a deprecated camelCase flag to its kebab-case replacement and warns on stderr, so a\n * script written against the old flag names keeps working during the deprecation window instead\n * of failing with an unknown-option error.\n */\nexport function resolveDeprecatedFlags(args: Array<string>): Array<string> {\n return args.map((arg) => {\n const match = FLAG_PATTERN.exec(arg)\n const name = match?.[1]\n const replacement = name ? DEPRECATED_FLAGS[name] : undefined\n\n if (!name || !replacement) {\n return arg\n }\n\n console.error(\n `${styleText('yellow', 'Warning:')} --${name} is deprecated, use --${replacement} instead. --${name} will be removed in a future major version.`,\n )\n\n return `--${replacement}${match?.[2] ?? ''}`\n })\n}\n","import { styleText } from 'node:util'\nimport dryrun from '@gunshi/plugin-dryrun'\nimport { cli, lazy } from 'gunshi'\nimport { isDisabled as isTelemetryDisabled } from './Telemetry.ts'\nimport { version } from '../package.json'\nimport { QUIET_FLAGS } from './constants.ts'\nimport { resolveDeprecatedFlags } from './deprecatedFlags.ts'\n\n/**\n * Strips the leading executable + script entries when `process.argv` is passed directly.\n * Handles Node.js (`/usr/bin/node`), Bun (`/usr/local/bin/bun`), Deno, tsx, etc. All runtime\n * executable paths contain a path separator; bare command names do not.\n */\nfunction stripExecArgs(argv: Array<string>): Array<string> {\n const firstArgIsExecutablePath = (argv[0]?.includes('/') || argv[0]?.includes('\\\\')) ?? false\n return argv.length >= 2 && firstArgIsExecutablePath ? argv.slice(2) : argv\n}\n\n/**\n * Whether this run is `kubb studio snapshot --json`, which must print exactly one JSON object on\n * stdout so a script can parse it. The telemetry notice and gunshi's own header both write to\n * stdout by default, so both are suppressed for this one invocation shape.\n */\nfunction isSnapshotJson(args: Array<string>): boolean {\n return args[0] === 'studio' && args[1] === 'snapshot' && args.includes('--json')\n}\n\n/**\n * Entry point for the `kubb` CLI. Prints the telemetry notice unless telemetry is disabled or a\n * quiet flag is passed, then runs the generate, validate, mcp, studio, and init commands. Defaults to\n * `generate` when no command is given.\n */\nexport async function run(argv: Array<string> = process.argv): Promise<void> {\n const args = resolveDeprecatedFlags(stripExecArgs(argv))\n const isQuietFlag = args.some((arg) => QUIET_FLAGS.has(arg)) || isSnapshotJson(args)\n\n if (!isTelemetryDisabled() && !isQuietFlag) {\n console.log(\n `${styleText('yellow', 'Notice:')} Kubb collects anonymous telemetry data to help improve the tool. No personal data or file contents are collected. \\nTo disable, set ${styleText('cyan', 'KUBB_DISABLE_TELEMETRY=1')}.\\n`,\n )\n }\n\n const { command: generateCommand } = await import('./commands/generate.ts')\n const { command: initCommand } = await import('./commands/init.ts')\n // Each runner pulls in an optional peer (@kubb/adapter-oas, @kubb/mcp, @kubb/studio), so it\n // loads only when its command runs.\n const { definition: validateDefinition } = await import('./commands/validate.ts')\n const validateCommand = lazy(async () => (await import('./runners/validate/run.ts')).runner, validateDefinition)\n const { definition: mcpDefinition } = await import('./commands/mcp.ts')\n const mcpCommand = lazy(async () => (await import('./runners/mcp/run.ts')).runner, mcpDefinition)\n const { definition: studioDefinition } = await import('./commands/studio.ts')\n const studioCommand = lazy(async () => (await import('./runners/studio/run.ts')).runner, studioDefinition)\n\n await cli(args, generateCommand, {\n name: 'kubb',\n version,\n // Not `generateCommand.description`: gunshi prints this on every subcommand's help too, so\n // `kubb studio --help` would open with a paragraph about generating types.\n description: 'Generate code from an OpenAPI specification, or connect the project to Kubb Studio.',\n subCommands: {\n generate: generateCommand,\n init: initCommand,\n validate: validateCommand,\n mcp: mcpCommand,\n studio: studioCommand,\n },\n fallbackToEntry: true,\n strict: true,\n plugins: [dryrun({ name: 'dry-run' })],\n // `snapshot --json` owns stdout: gunshi's default header would otherwise print ahead of it.\n ...(isSnapshotJson(args) ? { renderHeader: null } : {}),\n onErrorCommand: async (_ctx, error) => {\n process.exitCode = 1\n console.error(error)\n },\n })\n}\n"],"mappings":";;;;;;;;;;;AAMA,MAAM,mBAA2C;CAC/C,YAAY;CACZ,iBAAiB;CACjB,YAAY;CACZ,WAAW;CACX,UAAU;CACV,QAAQ;CACR,gBAAgB;AAClB;AAEA,MAAM,eAAe;;;;;;AAOrB,SAAgB,uBAAuB,MAAoC;CACzE,OAAO,KAAK,KAAK,QAAQ;EACvB,MAAM,QAAQ,aAAa,KAAK,GAAG;EACnC,MAAM,OAAO,QAAQ;EACrB,MAAM,cAAc,OAAO,iBAAiB,QAAQ,KAAA;EAEpD,IAAI,CAAC,QAAQ,CAAC,aACZ,OAAO;EAGT,QAAQ,MACN,GAAG,UAAU,UAAU,UAAU,EAAE,KAAK,KAAK,wBAAwB,YAAY,cAAc,KAAK,4CACtG;EAEA,OAAO,KAAK,cAAc,QAAQ,MAAM;CAC1C,CAAC;AACH;;;;;;;;AC1BA,SAAS,cAAc,MAAoC;CACzD,MAAM,4BAA4B,KAAK,EAAE,EAAE,SAAS,GAAG,KAAK,KAAK,EAAE,EAAE,SAAS,IAAI,MAAM;CACxF,OAAO,KAAK,UAAU,KAAK,2BAA2B,KAAK,MAAM,CAAC,IAAI;AACxE;;;;;;AAOA,SAAS,eAAe,MAA8B;CACpD,OAAO,KAAK,OAAO,YAAY,KAAK,OAAO,cAAc,KAAK,SAAS,QAAQ;AACjF;;;;;;AAOA,eAAsB,IAAI,OAAsB,QAAQ,MAAqB;CAC3E,MAAM,OAAO,uBAAuB,cAAc,IAAI,CAAC;CACvD,MAAM,cAAc,KAAK,MAAM,QAAQ,YAAY,IAAI,GAAG,CAAC,KAAK,eAAe,IAAI;CAEnF,IAAI,CAACA,WAAoB,KAAK,CAAC,aAC7B,QAAQ,IACN,GAAG,UAAU,UAAU,SAAS,EAAE,uIAAuI,UAAU,QAAQ,0BAA0B,EAAE,IACzN;CAGF,MAAM,EAAE,SAAS,oBAAoB,MAAM,OAAO;CAClD,MAAM,EAAE,SAAS,gBAAgB,MAAM,OAAO;CAG9C,MAAM,EAAE,YAAY,uBAAuB,MAAM,OAAO;CACxD,MAAM,kBAAkB,KAAK,aAAa,MAAM,OAAO,qBAAA,CAA8B,QAAQ,kBAAkB;CAC/G,MAAM,EAAE,YAAY,kBAAkB,MAAM,OAAO;CACnD,MAAM,aAAa,KAAK,aAAa,MAAM,OAAO,qBAAA,CAAyB,QAAQ,aAAa;CAChG,MAAM,EAAE,YAAY,qBAAqB,MAAM,OAAO;CACtD,MAAM,gBAAgB,KAAK,aAAa,MAAM,OAAO,qBAAA,CAA4B,QAAQ,gBAAgB;CAEzG,MAAM,IAAI,MAAM,iBAAiB;EAC/B,MAAM;EACN;EAGA,aAAa;EACb,aAAa;GACX,UAAU;GACV,MAAM;GACN,UAAU;GACV,KAAK;GACL,QAAQ;EACV;EACA,iBAAiB;EACjB,QAAQ;EACR,SAAS,CAAC,OAAO,EAAE,MAAM,UAAU,CAAC,CAAC;EAErC,GAAI,eAAe,IAAI,IAAI,EAAE,cAAc,KAAK,IAAI,CAAC;EACrD,gBAAgB,OAAO,MAAM,UAAU;GACrC,QAAQ,WAAW;GACnB,QAAQ,MAAM,KAAK;EACrB;CACF,CAAC;AACH"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
require("./rolldown-runtime-qbf5tadS.cjs");
|
|
2
|
-
const require_package = require("./package-
|
|
2
|
+
const require_package = require("./package-VYHX-Cpv.cjs");
|
|
3
3
|
let gunshi = require("gunshi");
|
|
4
4
|
let _gunshi_plugin_dryrun = require("@gunshi/plugin-dryrun");
|
|
5
5
|
//#region src/commands/init.ts
|
|
@@ -11,8 +11,9 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
11
11
|
"kubb init --yes",
|
|
12
12
|
"kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod",
|
|
13
13
|
"kubb init --plugins plugin-ts,plugin-axios,plugin-react-query",
|
|
14
|
-
"kubb init --yes --
|
|
14
|
+
"kubb init --yes --dry-run"
|
|
15
15
|
].join("\n"),
|
|
16
|
+
toKebab: true,
|
|
16
17
|
args: {
|
|
17
18
|
yes: {
|
|
18
19
|
type: "boolean",
|
|
@@ -54,4 +55,4 @@ const command = (0, gunshi.defineWithTypes)()({
|
|
|
54
55
|
//#endregion
|
|
55
56
|
exports.command = command;
|
|
56
57
|
|
|
57
|
-
//# sourceMappingURL=init-
|
|
58
|
+
//# sourceMappingURL=init-DlefULI4.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-DlefULI4.cjs","names":["defineWithTypes","dryRunId"],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineWithTypes } from 'gunshi'\nimport { dryRunId } from '../gunshiDryRun.ts'\nimport type { DryRunExtensions } from '../gunshiDryRun.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\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 --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 default options',\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 list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n"],"mappings":";;;;;AAKA,MAAa,WAAA,GAAUA,OAAAA,gBAAAA,CAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aACE;CACF,UAAU;EACR;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,IAAI,KAAK;EACb,MAAM,EAAE,WAAW;EACnB,MAAM,EAAE,QAAQ,MAAA,QAAA,QAAA,CAAA,CAAA,WAAA,QAAM,oBAAA,CAAA;EAEtB,MAAM,IAAI;GACR,KAAK,OAAO;GACZ,SAAA,gBAAA;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;GAChB,QAAQ,IAAI,WAAWC,sBAAAA;EACzB,CAAC;CACH;AACF,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import "./rolldown-runtime-C0LytTxp.js";
|
|
2
|
-
import { t as version } from "./package-
|
|
2
|
+
import { t as version } from "./package-C8jSgTtL.js";
|
|
3
3
|
import { t as dryRunId } from "./gunshiDryRun-DdKJuVn1.js";
|
|
4
4
|
import { defineWithTypes } from "gunshi";
|
|
5
5
|
//#region src/commands/init.ts
|
|
@@ -11,8 +11,9 @@ const command = defineWithTypes()({
|
|
|
11
11
|
"kubb init --yes",
|
|
12
12
|
"kubb init --input ./openapi.yaml --output ./src/gen --plugins plugin-ts,plugin-zod",
|
|
13
13
|
"kubb init --plugins plugin-ts,plugin-axios,plugin-react-query",
|
|
14
|
-
"kubb init --yes --
|
|
14
|
+
"kubb init --yes --dry-run"
|
|
15
15
|
].join("\n"),
|
|
16
|
+
toKebab: true,
|
|
16
17
|
args: {
|
|
17
18
|
yes: {
|
|
18
19
|
type: "boolean",
|
|
@@ -54,4 +55,4 @@ const command = defineWithTypes()({
|
|
|
54
55
|
//#endregion
|
|
55
56
|
export { command };
|
|
56
57
|
|
|
57
|
-
//# sourceMappingURL=init-
|
|
58
|
+
//# sourceMappingURL=init-Mfgx1m1H.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-Mfgx1m1H.js","names":[],"sources":["../src/commands/init.ts"],"sourcesContent":["import { defineWithTypes } from 'gunshi'\nimport { dryRunId } from '../gunshiDryRun.ts'\nimport type { DryRunExtensions } from '../gunshiDryRun.ts'\nimport { version } from '../../package.json'\n\nexport const command = defineWithTypes<{ extensions: DryRunExtensions }>()({\n name: 'init',\n description:\n 'Scaffold a kubb.config.ts and install plugins for code generation from an OpenAPI spec. Run without flags for interactive setup, or pass --input, --output, and --plugins to skip the prompts.',\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 --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 default options',\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 list of plugins to use (plugin-ts, plugin-axios, plugin-fetch, plugin-react-query, plugin-vue-query, plugin-zod, plugin-faker, plugin-msw, plugin-cypress, plugin-mcp, plugin-redoc)',\n metavar: 'plugin-ts,plugin-zod,...',\n },\n },\n async run(ctx) {\n const { values } = ctx\n const { run } = await import('../runners/init/run.ts')\n\n await run({\n yes: values.yes,\n version,\n input: values.input,\n output: values.output,\n plugins: values.plugins,\n dryRun: ctx.extensions[dryRunId],\n })\n },\n})\n"],"mappings":";;;;;AAKA,MAAa,UAAU,gBAAkD,CAAC,CAAC;CACzE,MAAM;CACN,aACE;CACF,UAAU;EACR;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,IAAI,KAAK;EACb,MAAM,EAAE,WAAW;EACnB,MAAM,EAAE,QAAQ,MAAM,OAAO;EAE7B,MAAM,IAAI;GACR,KAAK,OAAO;GACZ;GACA,OAAO,OAAO;GACd,QAAQ,OAAO;GACf,SAAS,OAAO;GAChB,QAAQ,IAAI,WAAW;EACzB,CAAC;CACH;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-C8jSgTtL.js","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region package.json
|
|
2
|
-
var version = "5.3.
|
|
2
|
+
var version = "5.3.2";
|
|
3
3
|
//#endregion
|
|
4
4
|
Object.defineProperty(exports, "version", {
|
|
5
5
|
enumerable: true,
|
|
@@ -8,4 +8,4 @@ Object.defineProperty(exports, "version", {
|
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
|
|
11
|
-
//# sourceMappingURL=package-
|
|
11
|
+
//# sourceMappingURL=package-VYHX-Cpv.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-VYHX-Cpv.cjs","names":[],"sources":["../package.json"],"sourcesContent":[""],"mappings":""}
|
|
@@ -2,7 +2,7 @@ const require_rolldown_runtime = require("./rolldown-runtime-qbf5tadS.cjs");
|
|
|
2
2
|
const require_errors = require("./errors-C-wEou02.cjs");
|
|
3
3
|
const require_Telemetry = require("./Telemetry-CvHQevSK.cjs");
|
|
4
4
|
const require_utils = require("./utils-CMU1rLfY.cjs");
|
|
5
|
-
const require_package = require("./package-
|
|
5
|
+
const require_package = require("./package-VYHX-Cpv.cjs");
|
|
6
6
|
const require_output = require("./output-kmklyYIv.cjs");
|
|
7
7
|
let node_util = require("node:util");
|
|
8
8
|
let node_crypto = require("node:crypto");
|
|
@@ -288,4 +288,4 @@ async function run({ input, configPath, logLevel: logLevelKey, watch, reporters:
|
|
|
288
288
|
//#endregion
|
|
289
289
|
exports.run = run;
|
|
290
290
|
|
|
291
|
-
//# sourceMappingURL=run-
|
|
291
|
+
//# sourceMappingURL=run-BKJr0PQx.cjs.map
|