@kubb/cli 0.13.0 → 0.14.1
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 +32 -49
- package/dist/index.mjs +24 -25
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,33 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (let key of __getOwnPropNames(from))
|
|
11
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
12
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
13
|
-
}
|
|
14
|
-
return to;
|
|
15
|
-
};
|
|
16
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
17
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
18
|
-
mod
|
|
19
|
-
));
|
|
2
|
+
'use strict';
|
|
20
3
|
|
|
21
|
-
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
// src/run.ts
|
|
28
|
-
var import_picocolors = __toESM(require("picocolors"));
|
|
29
|
-
var import_ora = __toESM(require("ora"));
|
|
30
|
-
var import_core = require("@kubb/core");
|
|
4
|
+
var commander = require('commander');
|
|
5
|
+
var cosmiconfig = require('cosmiconfig');
|
|
6
|
+
var cosmiconfigTypescriptLoader = require('cosmiconfig-typescript-loader');
|
|
7
|
+
var pc2 = require('picocolors');
|
|
8
|
+
var ora = require('ora');
|
|
9
|
+
var core = require('@kubb/core');
|
|
31
10
|
|
|
32
11
|
// src/utils/getPlugins.ts
|
|
33
12
|
var isJSONPlugins = (plugins) => {
|
|
@@ -67,45 +46,46 @@ var createConfig = async (result) => {
|
|
|
67
46
|
};
|
|
68
47
|
|
|
69
48
|
// src/run.ts
|
|
70
|
-
async function run(result, options) {
|
|
71
|
-
const spinner = (0, import_ora.default)({
|
|
72
|
-
color: "blue",
|
|
73
|
-
text: import_picocolors.default.blue("Kubb generation started"),
|
|
74
|
-
spinner: "timeTravel"
|
|
75
|
-
}).start();
|
|
49
|
+
async function run({ result, options, spinner: spinner2 }) {
|
|
76
50
|
const logger = {
|
|
77
51
|
log(message, logLevel) {
|
|
78
52
|
if (logLevel === "error") {
|
|
79
|
-
|
|
53
|
+
spinner2.fail(message);
|
|
80
54
|
}
|
|
81
|
-
|
|
55
|
+
spinner2[logLevel](message);
|
|
82
56
|
},
|
|
83
|
-
spinner
|
|
57
|
+
spinner: spinner2
|
|
84
58
|
};
|
|
85
59
|
try {
|
|
60
|
+
spinner2.start("Building");
|
|
86
61
|
const config = await createConfig(result);
|
|
87
|
-
await
|
|
62
|
+
await core.build({
|
|
88
63
|
config: {
|
|
89
|
-
...
|
|
64
|
+
...core.defaultConfig,
|
|
90
65
|
...config
|
|
91
66
|
},
|
|
92
67
|
mode: options.mode || "development",
|
|
93
68
|
logger
|
|
94
69
|
});
|
|
95
|
-
|
|
70
|
+
spinner2.succeed(pc2.blue("Kubb generation done"));
|
|
96
71
|
} catch (err) {
|
|
97
|
-
|
|
72
|
+
spinner2.fail("Something went wrong\n");
|
|
98
73
|
console.error(err);
|
|
99
74
|
}
|
|
100
75
|
return true;
|
|
101
76
|
}
|
|
102
77
|
|
|
103
78
|
// package.json
|
|
104
|
-
var version = "0.
|
|
79
|
+
var version = "0.14.1";
|
|
105
80
|
|
|
106
81
|
// src/index.ts
|
|
107
82
|
var moduleName = "kubb";
|
|
108
|
-
var
|
|
83
|
+
var spinner = ora({
|
|
84
|
+
color: "blue",
|
|
85
|
+
text: pc2.blue("Kubb generation started"),
|
|
86
|
+
spinner: "timeTravel"
|
|
87
|
+
}).start();
|
|
88
|
+
var explorer = cosmiconfig.cosmiconfig(moduleName, {
|
|
109
89
|
searchPlaces: [
|
|
110
90
|
"package.json",
|
|
111
91
|
`.${moduleName}rc`,
|
|
@@ -118,16 +98,19 @@ var explorer = (0, import_cosmiconfig.cosmiconfig)(moduleName, {
|
|
|
118
98
|
`${moduleName}.config.ts`
|
|
119
99
|
],
|
|
120
100
|
loaders: {
|
|
121
|
-
".ts":
|
|
122
|
-
noExt:
|
|
101
|
+
".ts": cosmiconfigTypescriptLoader.TypeScriptLoader(),
|
|
102
|
+
noExt: cosmiconfig.defaultLoaders[".js"]
|
|
123
103
|
}
|
|
124
104
|
});
|
|
125
|
-
var program = new
|
|
105
|
+
var program = new commander.Command(moduleName).description("Codegen plugins").action(async (options) => {
|
|
106
|
+
spinner.succeed(pc2.blue("Kubb generation started"));
|
|
107
|
+
spinner.start("Loading config");
|
|
126
108
|
const result = options.config ? await explorer.load(options.config) : await explorer.search();
|
|
127
109
|
if (result?.isEmpty || !result || !result.config) {
|
|
128
|
-
|
|
110
|
+
spinner.fail(pc2.red("Config not defined, create a kubb.config.js or pass through your config with the option --config"));
|
|
129
111
|
return;
|
|
130
112
|
}
|
|
131
|
-
|
|
132
|
-
|
|
113
|
+
spinner.succeed("Config loaded");
|
|
114
|
+
await run({ result, spinner, options });
|
|
115
|
+
}).addOption(new commander.Option("-m, --mode <mode>", "Mode of Kubb, development or production").default("development")).addOption(new commander.Option("-c, --config <path>", "Path to @kubb config")).addOption(new commander.Option("-d, --debug", "Debug mode").default(false));
|
|
133
116
|
program.name(moduleName).description("Generate").version(version, "-v").parse();
|
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
|
|
9
|
-
// src/run.ts
|
|
10
|
-
import pc from "picocolors";
|
|
11
|
-
import ora from "ora";
|
|
12
|
-
import { build, defaultConfig } from "@kubb/core";
|
|
2
|
+
import { Command, Option } from 'commander';
|
|
3
|
+
import { cosmiconfig, defaultLoaders } from 'cosmiconfig';
|
|
4
|
+
import { TypeScriptLoader } from 'cosmiconfig-typescript-loader';
|
|
5
|
+
import pc2 from 'picocolors';
|
|
6
|
+
import ora from 'ora';
|
|
7
|
+
import { build, defaultConfig } from '@kubb/core';
|
|
13
8
|
|
|
14
9
|
// src/utils/getPlugins.ts
|
|
15
10
|
var isJSONPlugins = (plugins) => {
|
|
@@ -49,22 +44,18 @@ var createConfig = async (result) => {
|
|
|
49
44
|
};
|
|
50
45
|
|
|
51
46
|
// src/run.ts
|
|
52
|
-
async function run(result, options) {
|
|
53
|
-
const spinner = ora({
|
|
54
|
-
color: "blue",
|
|
55
|
-
text: pc.blue("Kubb generation started"),
|
|
56
|
-
spinner: "timeTravel"
|
|
57
|
-
}).start();
|
|
47
|
+
async function run({ result, options, spinner: spinner2 }) {
|
|
58
48
|
const logger = {
|
|
59
49
|
log(message, logLevel) {
|
|
60
50
|
if (logLevel === "error") {
|
|
61
|
-
|
|
51
|
+
spinner2.fail(message);
|
|
62
52
|
}
|
|
63
|
-
|
|
53
|
+
spinner2[logLevel](message);
|
|
64
54
|
},
|
|
65
|
-
spinner
|
|
55
|
+
spinner: spinner2
|
|
66
56
|
};
|
|
67
57
|
try {
|
|
58
|
+
spinner2.start("Building");
|
|
68
59
|
const config = await createConfig(result);
|
|
69
60
|
await build({
|
|
70
61
|
config: {
|
|
@@ -74,19 +65,24 @@ async function run(result, options) {
|
|
|
74
65
|
mode: options.mode || "development",
|
|
75
66
|
logger
|
|
76
67
|
});
|
|
77
|
-
|
|
68
|
+
spinner2.succeed(pc2.blue("Kubb generation done"));
|
|
78
69
|
} catch (err) {
|
|
79
|
-
|
|
70
|
+
spinner2.fail("Something went wrong\n");
|
|
80
71
|
console.error(err);
|
|
81
72
|
}
|
|
82
73
|
return true;
|
|
83
74
|
}
|
|
84
75
|
|
|
85
76
|
// package.json
|
|
86
|
-
var version = "0.
|
|
77
|
+
var version = "0.14.1";
|
|
87
78
|
|
|
88
79
|
// src/index.ts
|
|
89
80
|
var moduleName = "kubb";
|
|
81
|
+
var spinner = ora({
|
|
82
|
+
color: "blue",
|
|
83
|
+
text: pc2.blue("Kubb generation started"),
|
|
84
|
+
spinner: "timeTravel"
|
|
85
|
+
}).start();
|
|
90
86
|
var explorer = cosmiconfig(moduleName, {
|
|
91
87
|
searchPlaces: [
|
|
92
88
|
"package.json",
|
|
@@ -105,11 +101,14 @@ var explorer = cosmiconfig(moduleName, {
|
|
|
105
101
|
}
|
|
106
102
|
});
|
|
107
103
|
var program = new Command(moduleName).description("Codegen plugins").action(async (options) => {
|
|
104
|
+
spinner.succeed(pc2.blue("Kubb generation started"));
|
|
105
|
+
spinner.start("Loading config");
|
|
108
106
|
const result = options.config ? await explorer.load(options.config) : await explorer.search();
|
|
109
107
|
if (result?.isEmpty || !result || !result.config) {
|
|
110
|
-
|
|
108
|
+
spinner.fail(pc2.red("Config not defined, create a kubb.config.js or pass through your config with the option --config"));
|
|
111
109
|
return;
|
|
112
110
|
}
|
|
113
|
-
|
|
111
|
+
spinner.succeed("Config loaded");
|
|
112
|
+
await run({ result, spinner, options });
|
|
114
113
|
}).addOption(new Option("-m, --mode <mode>", "Mode of Kubb, development or production").default("development")).addOption(new Option("-c, --config <path>", "Path to @kubb config")).addOption(new Option("-d, --debug", "Debug mode").default(false));
|
|
115
114
|
program.name(moduleName).description("Generate").version(version, "-v").parse();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Generator cli",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,17 +20,17 @@
|
|
|
20
20
|
"!/**/__tests__/**"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@kubb/core": "0.
|
|
23
|
+
"@kubb/core": "0.14.1",
|
|
24
24
|
"commander": "^9.4.1",
|
|
25
25
|
"cosmiconfig": "^8.0.0",
|
|
26
26
|
"cosmiconfig-typescript-loader": "^4.3.0",
|
|
27
|
-
"ora": "^
|
|
27
|
+
"ora": "^6.1.2",
|
|
28
28
|
"picocolors": "^1.0.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"tsup": "^6.5.0",
|
|
32
32
|
"typescript": "^4.9.4",
|
|
33
|
-
"@types/node": "^18.11.
|
|
33
|
+
"@types/node": "^18.11.18"
|
|
34
34
|
},
|
|
35
35
|
"publishConfig": {
|
|
36
36
|
"access": "public",
|