@kubb/cli 1.1.8 → 1.1.10

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 ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+
3
+ import('../dist/index.js')
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
- const require$1 = mod.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (document.currentScript && document.currentScript.src || new URL('out.js', document.baseURI).href)));
29
- var __require = /* @__PURE__ */ ((x) => typeof require$1 !== "undefined" ? require$1 : typeof Proxy !== "undefined" ? new Proxy(x, {
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$1 !== "undefined")
33
- return require$1.apply(this, arguments);
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.8";
37
+ var version = "1.1.10";
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
- if (a.meta?.pluginName.length > b.meta?.pluginName.length)
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
- printErrors(error);
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, PluginError, ParallelPluginError, isPromise } from '@kubb/core';
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.8";
28
+ var version = "1.1.10";
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
- if (a.meta?.pluginName.length > b.meta?.pluginName.length)
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
- printErrors(error);
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,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/cli",
3
- "version": "1.1.8",
3
+ "version": "1.1.10",
4
4
  "description": "Generator cli",
5
5
  "keywords": [
6
6
  "typescript",
@@ -22,10 +22,11 @@
22
22
  "module": "dist/index.js",
23
23
  "types": "./dist/index.d.ts",
24
24
  "bin": {
25
- "kubb": "dist/index.js"
25
+ "kubb": "bin/kubb.js"
26
26
  },
27
27
  "files": [
28
28
  "dist",
29
+ "bin",
29
30
  "src",
30
31
  "!/**/**.test.**",
31
32
  "!/**/__tests__/**"
@@ -42,15 +43,15 @@
42
43
  "string-argv": "^0.3.2",
43
44
  "ts-node": "^10.9.1",
44
45
  "yaml": "^2.3.1",
45
- "@kubb/core": "1.1.8"
46
+ "@kubb/core": "1.1.10"
46
47
  },
47
48
  "devDependencies": {
48
49
  "@types/node": "^20.2.6",
49
50
  "tsup": "^6.7.0",
50
51
  "typescript": "^5.1.3",
51
- "@kubb/swagger": "1.1.8",
52
- "@kubb/tsup-config": "0.1.0",
53
- "@kubb/typescript-config": "0.1.0"
52
+ "@kubb/swagger": "1.1.10",
53
+ "@kubb/ts-config": "0.1.0",
54
+ "@kubb/tsup-config": "1.1.8"
54
55
  },
55
56
  "packageManager": "pnpm@8.3.0",
56
57
  "engines": {
@@ -66,7 +67,7 @@
66
67
  "build": "tsup",
67
68
  "clean": "rimraf ./dist",
68
69
  "lint": "eslint \"**/*.{ts,tsx}\"",
69
- "lint-fix": "eslint \"**/*.{ts,tsx}\" --quiet --fix",
70
+ "lint-fix": "bun run lint --quiet --fix",
70
71
  "release": "pnpm publish --no-git-check",
71
72
  "start": "tsup --watch",
72
73
  "test": "vitest --passWithNoTests",
package/src/index.ts CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env node
2
- /* eslint-disable no-console */
3
2
  import pathParser from 'node:path'
4
3
 
5
4
  import { Command, Option } from 'commander'
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) return 1
74
- if (a.meta?.pluginName.length > b.meta?.pluginName.length) return -1
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
- printErrors(error as Error)
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')