@kubb/cli 0.9.1 → 0.11.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/dist/index.js +6 -22
- package/dist/index.mjs +7 -19
- package/package.json +7 -11
package/dist/index.js
CHANGED
|
@@ -5,10 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
8
|
var __copyProps = (to, from, except, desc) => {
|
|
13
9
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
10
|
for (let key of __getOwnPropNames(from))
|
|
@@ -21,14 +17,8 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
21
17
|
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
18
|
mod
|
|
23
19
|
));
|
|
24
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
20
|
|
|
26
21
|
// src/index.ts
|
|
27
|
-
var src_exports = {};
|
|
28
|
-
__export(src_exports, {
|
|
29
|
-
moduleName: () => moduleName
|
|
30
|
-
});
|
|
31
|
-
module.exports = __toCommonJS(src_exports);
|
|
32
22
|
var import_commander = require("commander");
|
|
33
23
|
var import_cosmiconfig = require("cosmiconfig");
|
|
34
24
|
var import_cosmiconfig_typescript_loader = require("cosmiconfig-typescript-loader");
|
|
@@ -47,9 +37,9 @@ var isJSONPlugins = (plugins) => {
|
|
|
47
37
|
};
|
|
48
38
|
var getPlugins = (plugins) => {
|
|
49
39
|
if (isJSONPlugins(plugins)) {
|
|
50
|
-
return plugins.map((plugin) => {
|
|
40
|
+
return plugins.map(async (plugin) => {
|
|
51
41
|
const [name, options = {}] = plugin;
|
|
52
|
-
const importedPlugin =
|
|
42
|
+
const importedPlugin = await import(name);
|
|
53
43
|
return importedPlugin?.default ? importedPlugin.default(options) : importedPlugin(options);
|
|
54
44
|
});
|
|
55
45
|
}
|
|
@@ -114,8 +104,6 @@ var explorer = (0, import_cosmiconfig.cosmiconfig)(moduleName, {
|
|
|
114
104
|
"package.json",
|
|
115
105
|
`.${moduleName}rc`,
|
|
116
106
|
`.${moduleName}rc.json`,
|
|
117
|
-
`.${moduleName}rc.yaml`,
|
|
118
|
-
`.${moduleName}rc.yml`,
|
|
119
107
|
`.${moduleName}rc.js`,
|
|
120
108
|
`.${moduleName}rc.cjs`,
|
|
121
109
|
`${moduleName}.config.js`,
|
|
@@ -124,10 +112,11 @@ var explorer = (0, import_cosmiconfig.cosmiconfig)(moduleName, {
|
|
|
124
112
|
`${moduleName}.config.ts`
|
|
125
113
|
],
|
|
126
114
|
loaders: {
|
|
127
|
-
".ts": (0, import_cosmiconfig_typescript_loader.TypeScriptLoader)()
|
|
115
|
+
".ts": (0, import_cosmiconfig_typescript_loader.TypeScriptLoader)(),
|
|
116
|
+
noExt: import_cosmiconfig.defaultLoaders[".js"]
|
|
128
117
|
}
|
|
129
118
|
});
|
|
130
|
-
var program = new import_commander.Command("
|
|
119
|
+
var program = new import_commander.Command("kubb").description("Generate models").action(async (options) => {
|
|
131
120
|
const result = options.config ? await explorer.load(options.config) : await explorer.search();
|
|
132
121
|
if (result?.isEmpty || !result || !result.config) {
|
|
133
122
|
console.log(import_picocolors2.default.red("Config not defined, create a kubb.config.js or pass through your config with the option --config"));
|
|
@@ -151,9 +140,4 @@ ${JSON.stringify(result?.config, void 0, 2)}`);
|
|
|
151
140
|
}
|
|
152
141
|
await run(result);
|
|
153
142
|
}).addOption(new import_commander.Option("-c, --config <path>", "Path to @kubb config")).addOption(new import_commander.Option("-d, --debug", "Debug mode").default(false));
|
|
154
|
-
program.name(moduleName).description("Generate").version("0.0.1");
|
|
155
|
-
program.parse();
|
|
156
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
157
|
-
0 && (module.exports = {
|
|
158
|
-
moduleName
|
|
159
|
-
});
|
|
143
|
+
program.name(moduleName).description("Generate").version("0.0.1").parse();
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
|
-
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
|
-
}) : x)(function(x) {
|
|
5
|
-
if (typeof require !== "undefined")
|
|
6
|
-
return require.apply(this, arguments);
|
|
7
|
-
throw new Error('Dynamic require of "' + x + '" is not supported');
|
|
8
|
-
});
|
|
9
2
|
|
|
10
3
|
// src/index.ts
|
|
11
4
|
import { Command, Option } from "commander";
|
|
12
|
-
import { cosmiconfig } from "cosmiconfig";
|
|
5
|
+
import { cosmiconfig, defaultLoaders } from "cosmiconfig";
|
|
13
6
|
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";
|
|
14
7
|
import pc2 from "picocolors";
|
|
15
8
|
|
|
@@ -26,9 +19,9 @@ var isJSONPlugins = (plugins) => {
|
|
|
26
19
|
};
|
|
27
20
|
var getPlugins = (plugins) => {
|
|
28
21
|
if (isJSONPlugins(plugins)) {
|
|
29
|
-
return plugins.map((plugin) => {
|
|
22
|
+
return plugins.map(async (plugin) => {
|
|
30
23
|
const [name, options = {}] = plugin;
|
|
31
|
-
const importedPlugin =
|
|
24
|
+
const importedPlugin = await import(name);
|
|
32
25
|
return importedPlugin?.default ? importedPlugin.default(options) : importedPlugin(options);
|
|
33
26
|
});
|
|
34
27
|
}
|
|
@@ -93,8 +86,6 @@ var explorer = cosmiconfig(moduleName, {
|
|
|
93
86
|
"package.json",
|
|
94
87
|
`.${moduleName}rc`,
|
|
95
88
|
`.${moduleName}rc.json`,
|
|
96
|
-
`.${moduleName}rc.yaml`,
|
|
97
|
-
`.${moduleName}rc.yml`,
|
|
98
89
|
`.${moduleName}rc.js`,
|
|
99
90
|
`.${moduleName}rc.cjs`,
|
|
100
91
|
`${moduleName}.config.js`,
|
|
@@ -103,10 +94,11 @@ var explorer = cosmiconfig(moduleName, {
|
|
|
103
94
|
`${moduleName}.config.ts`
|
|
104
95
|
],
|
|
105
96
|
loaders: {
|
|
106
|
-
".ts": TypeScriptLoader()
|
|
97
|
+
".ts": TypeScriptLoader(),
|
|
98
|
+
noExt: defaultLoaders[".js"]
|
|
107
99
|
}
|
|
108
100
|
});
|
|
109
|
-
var program = new Command("
|
|
101
|
+
var program = new Command("kubb").description("Generate models").action(async (options) => {
|
|
110
102
|
const result = options.config ? await explorer.load(options.config) : await explorer.search();
|
|
111
103
|
if (result?.isEmpty || !result || !result.config) {
|
|
112
104
|
console.log(pc2.red("Config not defined, create a kubb.config.js or pass through your config with the option --config"));
|
|
@@ -130,8 +122,4 @@ ${JSON.stringify(result?.config, void 0, 2)}`);
|
|
|
130
122
|
}
|
|
131
123
|
await run(result);
|
|
132
124
|
}).addOption(new Option("-c, --config <path>", "Path to @kubb config")).addOption(new Option("-d, --debug", "Debug mode").default(false));
|
|
133
|
-
program.name(moduleName).description("Generate").version("0.0.1");
|
|
134
|
-
program.parse();
|
|
135
|
-
export {
|
|
136
|
-
moduleName
|
|
137
|
-
};
|
|
125
|
+
program.name(moduleName).description("Generate").version("0.0.1").parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Generator cli",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,23 +20,19 @@
|
|
|
20
20
|
"!/**/__tests__/**"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@kubb/core": "0.
|
|
23
|
+
"@kubb/core": "0.11.0",
|
|
24
24
|
"commander": "^9.4.1",
|
|
25
25
|
"cosmiconfig": "^8.0.0",
|
|
26
26
|
"cosmiconfig-typescript-loader": "^4.2.0",
|
|
27
27
|
"ora": "^5.4.1",
|
|
28
|
-
"picocolors": "^1.0.0"
|
|
29
|
-
"ts-node": "^10.9.1"
|
|
28
|
+
"picocolors": "^1.0.0"
|
|
30
29
|
},
|
|
31
30
|
"devDependencies": {
|
|
32
|
-
"@kubb/swagger": "0.
|
|
33
|
-
"@kubb/swagger-typescript": "0.
|
|
31
|
+
"@kubb/swagger": "0.11.0",
|
|
32
|
+
"@kubb/swagger-typescript": "0.11.0",
|
|
34
33
|
"tsup": "^6.5.0",
|
|
35
|
-
"typescript": "^4.9.
|
|
36
|
-
"@types/node": "^18.11.
|
|
37
|
-
"axios": "^1.2.0",
|
|
38
|
-
"@tanstack/react-query": "^4.18.0",
|
|
39
|
-
"react": "^18.2.0"
|
|
34
|
+
"typescript": "^4.9.4",
|
|
35
|
+
"@types/node": "^18.11.13"
|
|
40
36
|
},
|
|
41
37
|
"publishConfig": {
|
|
42
38
|
"access": "public",
|