@kubb/cli
Advanced tools
Comparing version 0.14.0 to 0.14.1
#!/usr/bin/env node | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
var __getOwnPropNames = Object.getOwnPropertyNames; | ||
var __getProtoOf = Object.getPrototypeOf; | ||
var __hasOwnProp = Object.prototype.hasOwnProperty; | ||
var __copyProps = (to, from, except, desc) => { | ||
if (from && typeof from === "object" || typeof from === "function") { | ||
for (let key of __getOwnPropNames(from)) | ||
if (!__hasOwnProp.call(to, key) && key !== except) | ||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); | ||
} | ||
return to; | ||
}; | ||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps( | ||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, | ||
mod | ||
)); | ||
'use strict'; | ||
// src/index.ts | ||
var import_commander = require("commander"); | ||
var import_cosmiconfig = require("cosmiconfig"); | ||
var import_cosmiconfig_typescript_loader = require("cosmiconfig-typescript-loader"); | ||
var import_picocolors2 = __toESM(require("picocolors")); | ||
var commander = require('commander'); | ||
var cosmiconfig = require('cosmiconfig'); | ||
var cosmiconfigTypescriptLoader = require('cosmiconfig-typescript-loader'); | ||
var pc2 = require('picocolors'); | ||
var ora = require('ora'); | ||
var core = require('@kubb/core'); | ||
// src/run.ts | ||
var import_picocolors = __toESM(require("picocolors")); | ||
var import_ora = __toESM(require("ora")); | ||
var import_core = require("@kubb/core"); | ||
// src/utils/getPlugins.ts | ||
@@ -70,22 +49,18 @@ var isJSONPlugins = (plugins) => { | ||
// src/run.ts | ||
async function run(result, options) { | ||
const spinner = (0, import_ora.default)({ | ||
color: "blue", | ||
text: import_picocolors.default.blue("Kubb generation started"), | ||
spinner: "timeTravel" | ||
}).start(); | ||
async function run({ result, options, spinner: spinner2 }) { | ||
const logger = { | ||
log(message, logLevel) { | ||
if (logLevel === "error") { | ||
spinner.fail(message); | ||
spinner2.fail(message); | ||
} | ||
spinner[logLevel](message); | ||
spinner2[logLevel](message); | ||
}, | ||
spinner | ||
spinner: spinner2 | ||
}; | ||
try { | ||
spinner2.start("Building"); | ||
const config = await createConfig(result); | ||
await (0, import_core.build)({ | ||
await core.build({ | ||
config: { | ||
...import_core.defaultConfig, | ||
...core.defaultConfig, | ||
...config | ||
@@ -96,5 +71,5 @@ }, | ||
}); | ||
spinner.succeed(import_picocolors.default.blue("Kubb generation done")); | ||
spinner2.succeed(pc2.blue("Kubb generation done")); | ||
} catch (err) { | ||
spinner.fail("Something went wrong\n"); | ||
spinner2.fail("Something went wrong\n"); | ||
console.error(err); | ||
@@ -106,7 +81,12 @@ } | ||
// package.json | ||
var version = "0.14.0"; | ||
var version = "0.14.1"; | ||
// src/index.ts | ||
var moduleName = "kubb"; | ||
var explorer = (0, import_cosmiconfig.cosmiconfig)(moduleName, { | ||
var spinner = ora({ | ||
color: "blue", | ||
text: pc2.blue("Kubb generation started"), | ||
spinner: "timeTravel" | ||
}).start(); | ||
var explorer = cosmiconfig.cosmiconfig(moduleName, { | ||
searchPlaces: [ | ||
@@ -124,14 +104,17 @@ "package.json", | ||
loaders: { | ||
".ts": (0, import_cosmiconfig_typescript_loader.TypeScriptLoader)(), | ||
noExt: import_cosmiconfig.defaultLoaders[".js"] | ||
".ts": cosmiconfigTypescriptLoader.TypeScriptLoader(), | ||
noExt: cosmiconfig.defaultLoaders[".js"] | ||
} | ||
}); | ||
var program = new import_commander.Command(moduleName).description("Codegen plugins").action(async (options) => { | ||
var program = new commander.Command(moduleName).description("Codegen plugins").action(async (options) => { | ||
spinner.succeed(pc2.blue("Kubb generation started")); | ||
spinner.start("Loading config"); | ||
const result = options.config ? await explorer.load(options.config) : await explorer.search(); | ||
if (result?.isEmpty || !result || !result.config) { | ||
console.log(import_picocolors2.default.red("Config not defined, create a kubb.config.js or pass through your config with the option --config")); | ||
spinner.fail(pc2.red("Config not defined, create a kubb.config.js or pass through your config with the option --config")); | ||
return; | ||
} | ||
await run(result, options); | ||
}).addOption(new import_commander.Option("-m, --mode <mode>", "Mode of Kubb, development or production").default("development")).addOption(new import_commander.Option("-c, --config <path>", "Path to @kubb config")).addOption(new import_commander.Option("-d, --debug", "Debug mode").default(false)); | ||
spinner.succeed("Config loaded"); | ||
await run({ result, spinner, options }); | ||
}).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)); | ||
program.name(moduleName).description("Generate").version(version, "-v").parse(); |
{ | ||
"name": "@kubb/cli", | ||
"version": "0.14.0", | ||
"version": "0.14.1", | ||
"description": "Generator cli", | ||
@@ -23,3 +23,3 @@ "repository": { | ||
"dependencies": { | ||
"@kubb/core": "0.14.0", | ||
"@kubb/core": "0.14.1", | ||
"commander": "^9.4.1", | ||
@@ -26,0 +26,0 @@ "cosmiconfig": "^8.0.0", |
Sorry, the diff of this file is not supported yet
9513
220
+ Added@kubb/core@0.14.1(transitive)
- Removed@kubb/core@0.14.0(transitive)
Updated@kubb/core@0.14.1