@kubb/cli 1.1.7 → 1.1.9
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 +34 -27
- package/bin/kubb.js +3 -0
- package/dist/index.cjs +16 -15
- package/dist/index.js +12 -9
- package/package.json +28 -24
- package/src/index.ts +0 -1
- package/src/run.ts +11 -10
package/README.md
CHANGED
|
@@ -5,38 +5,45 @@
|
|
|
5
5
|
|
|
6
6
|
<p>
|
|
7
7
|
CLI package to generate the different clients when using the terminal.
|
|
8
|
-
</p>
|
|
8
|
+
</p>
|
|
9
|
+
<img src="https://raw.githubusercontent.com/kubb-project/kubb/main/assets/banner.png" alt="logo" height="auto" />
|
|
9
10
|
|
|
10
|
-
<!-- Badges -->
|
|
11
|
-
<p>
|
|
12
|
-
<a href="https://www.npmjs.com/package/@kubb/cli">
|
|
11
|
+
<!-- Badges -->
|
|
12
|
+
<p>
|
|
13
|
+
<a href="https://www.npmjs.com/package/@kubb/cli" target="_blank">
|
|
13
14
|
<img alt="npm version" src="https://img.shields.io/npm/v/@kubb/cli?style=for-the-badge"/>
|
|
14
15
|
</a>
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
</a>
|
|
18
|
-
<a href="https://www.npmjs.com/package/@kubb/cli">
|
|
16
|
+
|
|
17
|
+
<a href="https://www.npmjs.com/package/@kubb/cli" target="_blank">
|
|
19
18
|
<img alt="npm downloads" src="https://img.shields.io/npm/dm/@kubb/cli?style=for-the-badge"/>
|
|
20
19
|
</a>
|
|
21
|
-
</p>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
<p>
|
|
23
|
+
<a href="https://www.npmjs.com/package/@kubb/cli" target="_blank">
|
|
24
|
+
<img alt="Minified size" src="https://img.shields.io/bundlephobia/min/@kubb/cli?style=for-the-badge"/>
|
|
25
|
+
</a>
|
|
26
|
+
|
|
27
|
+
<a href="https://www.npmjs.com/package/@kubb/cli" target="_blank">
|
|
28
|
+
<img alt="Coverage" src="https://img.shields.io/codecov/c/github/kubb-project/kubb?style=for-the-badge"/>
|
|
29
|
+
</a>
|
|
30
|
+
|
|
31
|
+
<a href="https://www.npmjs.com/package/@kubb/cli" target="_blank">
|
|
32
|
+
<img alt="Build status" src="https://img.shields.io/github/actions/workflow/status/kubb-project/kubb/ci.yaml?style=for-the-badge"/>
|
|
33
|
+
</a>
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
|
|
37
|
+
<!-- ALL-CONTRIBUTORS-BADGE:END -->
|
|
38
|
+
</p>
|
|
22
39
|
|
|
23
|
-
<h4>
|
|
24
|
-
<a href="https://codesandbox.io/s/github/kubb-project/kubb/tree/main/examples/simple">View Demo</a>
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
40
|
+
<h4>
|
|
41
|
+
<a href="https://codesandbox.io/s/github/kubb-project/kubb/tree/main/examples/simple" target="_blank">View Demo</a>
|
|
42
|
+
<span> · </span>
|
|
43
|
+
<a href="https://kubb.dev/" target="_blank">Documentation</a>
|
|
44
|
+
<span> · </span>
|
|
45
|
+
<a href="https://github.com/kubb-project/kubb/issues/" target="_blank">Report Bug</a>
|
|
46
|
+
<span> · </span>
|
|
47
|
+
<a href="https://github.com/kubb-project/kubb/issues/" target="_blank">Request Feature</a>
|
|
31
48
|
</h4>
|
|
32
49
|
</div>
|
|
33
|
-
|
|
34
|
-
<br />
|
|
35
|
-
|
|
36
|
-
<!-- About the Project
|
|
37
|
-
## :star2: About the Project
|
|
38
|
-
|
|
39
|
-
<div align="center">
|
|
40
|
-
<img src="assets/screenshot.jpg" alt="screenshot" />
|
|
41
|
-
</div>
|
|
42
|
-
-->
|
package/bin/kubb.js
ADDED
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var mod = require('module');
|
|
5
4
|
var pathParser = require('path');
|
|
6
5
|
var commander = require('commander');
|
|
7
6
|
var ora = require('ora');
|
|
@@ -10,6 +9,7 @@ var core = require('@kubb/core');
|
|
|
10
9
|
var execa = require('execa');
|
|
11
10
|
var PrettyError = require('pretty-error');
|
|
12
11
|
var stringArgv = require('string-argv');
|
|
12
|
+
var mod = require('module');
|
|
13
13
|
var url = require('url');
|
|
14
14
|
var cosmiconfig = require('cosmiconfig');
|
|
15
15
|
var tsNode = require('ts-node');
|
|
@@ -17,25 +17,24 @@ var yaml = require('yaml');
|
|
|
17
17
|
|
|
18
18
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
19
19
|
|
|
20
|
-
var mod__default = /*#__PURE__*/_interopDefault(mod);
|
|
21
20
|
var pathParser__default = /*#__PURE__*/_interopDefault(pathParser);
|
|
22
21
|
var ora__default = /*#__PURE__*/_interopDefault(ora);
|
|
23
22
|
var pc2__default = /*#__PURE__*/_interopDefault(pc2);
|
|
24
23
|
var PrettyError__default = /*#__PURE__*/_interopDefault(PrettyError);
|
|
24
|
+
var mod__default = /*#__PURE__*/_interopDefault(mod);
|
|
25
25
|
var tsNode__default = /*#__PURE__*/_interopDefault(tsNode);
|
|
26
26
|
var yaml__default = /*#__PURE__*/_interopDefault(yaml);
|
|
27
27
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
get: (a, b) => (typeof require$1 !== "undefined" ? require$1 : a)[b]
|
|
28
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
29
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
31
30
|
}) : x)(function(x) {
|
|
32
|
-
if (typeof require
|
|
33
|
-
return require
|
|
31
|
+
if (typeof require !== "undefined")
|
|
32
|
+
return require.apply(this, arguments);
|
|
34
33
|
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
35
34
|
});
|
|
36
35
|
|
|
37
36
|
// package.json
|
|
38
|
-
var version = "1.1.
|
|
37
|
+
var version = "1.1.9";
|
|
39
38
|
var presets = {
|
|
40
39
|
simple: {
|
|
41
40
|
"kubb.config": `
|
|
@@ -145,10 +144,12 @@ async function run({ config, options, spinner: spinner2 }) {
|
|
|
145
144
|
if (!a.meta?.pluginName || !b.meta?.pluginName) {
|
|
146
145
|
return 0;
|
|
147
146
|
}
|
|
148
|
-
if (a.meta?.pluginName.length < b.meta?.pluginName.length)
|
|
147
|
+
if (a.meta?.pluginName.length < b.meta?.pluginName.length) {
|
|
149
148
|
return 1;
|
|
150
|
-
|
|
149
|
+
}
|
|
150
|
+
if (a.meta?.pluginName.length > b.meta?.pluginName.length) {
|
|
151
151
|
return -1;
|
|
152
|
+
}
|
|
152
153
|
return 0;
|
|
153
154
|
});
|
|
154
155
|
const meta = {
|
|
@@ -170,10 +171,6 @@ ${pc2__default.default.bold("Generated:")} ${meta.filesCreated} files
|
|
|
170
171
|
};
|
|
171
172
|
const printErrors = (error) => {
|
|
172
173
|
const pe = new PrettyError__default.default();
|
|
173
|
-
if (error instanceof core.ParallelPluginError) {
|
|
174
|
-
error.errors.map((e) => printErrors(e));
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
174
|
if (options.debug) {
|
|
178
175
|
spinner2.fail(pc2__default.default.red(`Something went wrong
|
|
179
176
|
|
|
@@ -214,7 +211,11 @@ ${error?.message}`));
|
|
|
214
211
|
await onDone(config.hooks, logLevel);
|
|
215
212
|
printSummary(output.pluginManager, "success");
|
|
216
213
|
} catch (error) {
|
|
217
|
-
|
|
214
|
+
if (error instanceof core.ParallelPluginError) {
|
|
215
|
+
error.errors.map((e) => printErrors(e));
|
|
216
|
+
} else {
|
|
217
|
+
printErrors(error);
|
|
218
|
+
}
|
|
218
219
|
if (error instanceof core.PluginError || error instanceof core.ParallelPluginError) {
|
|
219
220
|
printSummary(error.pluginManager, "failed");
|
|
220
221
|
}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import pathParser from 'node:path';
|
|
|
4
4
|
import { Command, Option } from 'commander';
|
|
5
5
|
import ora from 'ora';
|
|
6
6
|
import pc2 from 'picocolors';
|
|
7
|
-
import { write, build,
|
|
7
|
+
import { write, build, ParallelPluginError, PluginError, isPromise } from '@kubb/core';
|
|
8
8
|
import { $, execa } from 'execa';
|
|
9
9
|
import PrettyError from 'pretty-error';
|
|
10
10
|
import { parseArgsStringToArgv } from 'string-argv';
|
|
@@ -15,6 +15,7 @@ import tsNode from 'ts-node';
|
|
|
15
15
|
import yaml from 'yaml';
|
|
16
16
|
|
|
17
17
|
const require = createRequire(import.meta.url);
|
|
18
|
+
|
|
18
19
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
19
20
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
20
21
|
}) : x)(function(x) {
|
|
@@ -24,7 +25,7 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
|
|
|
24
25
|
});
|
|
25
26
|
|
|
26
27
|
// package.json
|
|
27
|
-
var version = "1.1.
|
|
28
|
+
var version = "1.1.9";
|
|
28
29
|
var presets = {
|
|
29
30
|
simple: {
|
|
30
31
|
"kubb.config": `
|
|
@@ -134,10 +135,12 @@ async function run({ config, options, spinner: spinner2 }) {
|
|
|
134
135
|
if (!a.meta?.pluginName || !b.meta?.pluginName) {
|
|
135
136
|
return 0;
|
|
136
137
|
}
|
|
137
|
-
if (a.meta?.pluginName.length < b.meta?.pluginName.length)
|
|
138
|
+
if (a.meta?.pluginName.length < b.meta?.pluginName.length) {
|
|
138
139
|
return 1;
|
|
139
|
-
|
|
140
|
+
}
|
|
141
|
+
if (a.meta?.pluginName.length > b.meta?.pluginName.length) {
|
|
140
142
|
return -1;
|
|
143
|
+
}
|
|
141
144
|
return 0;
|
|
142
145
|
});
|
|
143
146
|
const meta = {
|
|
@@ -159,10 +162,6 @@ ${pc2.bold("Generated:")} ${meta.filesCreated} files
|
|
|
159
162
|
};
|
|
160
163
|
const printErrors = (error) => {
|
|
161
164
|
const pe = new PrettyError();
|
|
162
|
-
if (error instanceof ParallelPluginError) {
|
|
163
|
-
error.errors.map((e) => printErrors(e));
|
|
164
|
-
return;
|
|
165
|
-
}
|
|
166
165
|
if (options.debug) {
|
|
167
166
|
spinner2.fail(pc2.red(`Something went wrong
|
|
168
167
|
|
|
@@ -203,7 +202,11 @@ ${error?.message}`));
|
|
|
203
202
|
await onDone(config.hooks, logLevel);
|
|
204
203
|
printSummary(output.pluginManager, "success");
|
|
205
204
|
} catch (error) {
|
|
206
|
-
|
|
205
|
+
if (error instanceof ParallelPluginError) {
|
|
206
|
+
error.errors.map((e) => printErrors(e));
|
|
207
|
+
} else {
|
|
208
|
+
printErrors(error);
|
|
209
|
+
}
|
|
207
210
|
if (error instanceof PluginError || error instanceof ParallelPluginError) {
|
|
208
211
|
printSummary(error.pluginManager, "failed");
|
|
209
212
|
}
|
package/package.json
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/cli",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.9",
|
|
4
4
|
"description": "Generator cli",
|
|
5
|
-
"repository": {
|
|
6
|
-
"type": "git",
|
|
7
|
-
"url": "git://github.com/kubb-project/kubb.git",
|
|
8
|
-
"directory": "packages/cli"
|
|
9
|
-
},
|
|
10
|
-
"license": "MIT",
|
|
11
|
-
"author": "Stijn Van Hulle <stijn@stijnvanhulle.be",
|
|
12
5
|
"keywords": [
|
|
13
6
|
"typescript",
|
|
14
7
|
"plugins",
|
|
@@ -16,58 +9,69 @@
|
|
|
16
9
|
"codegen",
|
|
17
10
|
"cli"
|
|
18
11
|
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git://github.com/kubb-project/kubb.git",
|
|
15
|
+
"directory": "packages/cli"
|
|
16
|
+
},
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"author": "Stijn Van Hulle <stijn@stijnvanhulle.be",
|
|
19
19
|
"sideEffects": false,
|
|
20
20
|
"type": "module",
|
|
21
21
|
"main": "dist/index.js",
|
|
22
22
|
"module": "dist/index.js",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
24
|
"bin": {
|
|
25
|
-
"kubb": "
|
|
25
|
+
"kubb": "bin/kubb.js"
|
|
26
26
|
},
|
|
27
|
-
"preferGlobal": true,
|
|
28
27
|
"files": [
|
|
29
28
|
"dist",
|
|
29
|
+
"bin",
|
|
30
30
|
"src",
|
|
31
31
|
"!/**/**.test.**",
|
|
32
32
|
"!/**/__tests__/**"
|
|
33
33
|
],
|
|
34
34
|
"dependencies": {
|
|
35
|
+
"@swc/core": "^1.3.62",
|
|
35
36
|
"chokidar": "^3.5.3",
|
|
36
37
|
"commander": "^10.0.1",
|
|
37
38
|
"cosmiconfig": "^8.2.0",
|
|
38
39
|
"execa": "^7.1.1",
|
|
39
40
|
"ora": "^6.3.1",
|
|
40
41
|
"picocolors": "^1.0.0",
|
|
42
|
+
"pretty-error": "^4.0.0",
|
|
41
43
|
"string-argv": "^0.3.2",
|
|
42
44
|
"ts-node": "^10.9.1",
|
|
43
45
|
"yaml": "^2.3.1",
|
|
44
|
-
"@
|
|
45
|
-
"pretty-error": "^4.0.0",
|
|
46
|
-
"@kubb/core": "1.1.7"
|
|
46
|
+
"@kubb/core": "1.1.9"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
|
+
"@types/node": "^20.2.6",
|
|
49
50
|
"tsup": "^6.7.0",
|
|
50
|
-
"@types/node": "^20.2.5",
|
|
51
51
|
"typescript": "^5.1.3",
|
|
52
|
-
"@kubb/
|
|
53
|
-
"@kubb/tsup-config": "
|
|
52
|
+
"@kubb/ts-config": "0.1.0",
|
|
53
|
+
"@kubb/tsup-config": "1.1.8",
|
|
54
|
+
"@kubb/swagger": "1.1.9"
|
|
54
55
|
},
|
|
56
|
+
"packageManager": "pnpm@8.3.0",
|
|
57
|
+
"engines": {
|
|
58
|
+
"node": ">=18",
|
|
59
|
+
"pnpm": ">=8.3.0"
|
|
60
|
+
},
|
|
61
|
+
"preferGlobal": true,
|
|
55
62
|
"publishConfig": {
|
|
56
63
|
"access": "public",
|
|
57
64
|
"registry": "https://registry.npmjs.org/"
|
|
58
65
|
},
|
|
59
|
-
"engines": {
|
|
60
|
-
"node": ">=18",
|
|
61
|
-
"pnpm": ">=8"
|
|
62
|
-
},
|
|
63
66
|
"scripts": {
|
|
64
67
|
"build": "tsup",
|
|
65
|
-
"
|
|
66
|
-
"release": "pnpm publish --no-git-check",
|
|
68
|
+
"clean": "rimraf ./dist",
|
|
67
69
|
"lint": "eslint \"**/*.{ts,tsx}\"",
|
|
68
70
|
"lint-fix": "eslint \"**/*.{ts,tsx}\" --quiet --fix",
|
|
71
|
+
"release": "pnpm publish --no-git-check",
|
|
72
|
+
"start": "tsup --watch",
|
|
69
73
|
"test": "vitest --passWithNoTests",
|
|
70
|
-
"
|
|
71
|
-
"
|
|
74
|
+
"typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false",
|
|
75
|
+
"upgrade": "pnpm update"
|
|
72
76
|
}
|
|
73
77
|
}
|
package/src/index.ts
CHANGED
package/src/run.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import pathParser from 'node:path'
|
|
3
2
|
|
|
4
3
|
import { build, ParallelPluginError, PluginError } from '@kubb/core'
|
|
@@ -70,8 +69,12 @@ export async function run({ config, options, spinner }: RunProps): Promise<void>
|
|
|
70
69
|
if (!a.meta?.pluginName || !b.meta?.pluginName) {
|
|
71
70
|
return 0
|
|
72
71
|
}
|
|
73
|
-
if (a.meta?.pluginName.length < b.meta?.pluginName.length)
|
|
74
|
-
|
|
72
|
+
if (a.meta?.pluginName.length < b.meta?.pluginName.length) {
|
|
73
|
+
return 1
|
|
74
|
+
}
|
|
75
|
+
if (a.meta?.pluginName.length > b.meta?.pluginName.length) {
|
|
76
|
+
return -1
|
|
77
|
+
}
|
|
75
78
|
return 0
|
|
76
79
|
})
|
|
77
80
|
|
|
@@ -101,12 +104,6 @@ ${pc.bold('Generated:')} ${meta.filesCreated} files
|
|
|
101
104
|
const printErrors = (error: Error) => {
|
|
102
105
|
const pe = new PrettyError()
|
|
103
106
|
|
|
104
|
-
if (error instanceof ParallelPluginError) {
|
|
105
|
-
error.errors.map((e) => printErrors(e))
|
|
106
|
-
|
|
107
|
-
return
|
|
108
|
-
}
|
|
109
|
-
|
|
110
107
|
if (options.debug) {
|
|
111
108
|
spinner.fail(pc.red(`Something went wrong\n\n`))
|
|
112
109
|
const causedError = error?.cause as Error
|
|
@@ -151,7 +148,11 @@ ${pc.bold('Generated:')} ${meta.filesCreated} files
|
|
|
151
148
|
|
|
152
149
|
printSummary(output.pluginManager, 'success')
|
|
153
150
|
} catch (error: any) {
|
|
154
|
-
|
|
151
|
+
if (error instanceof ParallelPluginError) {
|
|
152
|
+
error.errors.map((e) => printErrors(e))
|
|
153
|
+
} else {
|
|
154
|
+
printErrors(error as Error)
|
|
155
|
+
}
|
|
155
156
|
|
|
156
157
|
if (error instanceof PluginError || error instanceof ParallelPluginError) {
|
|
157
158
|
printSummary(error.pluginManager, 'failed')
|