@kubb/cli
Advanced tools
Comparing version 1.0.0-beta.9 to 1.0.0-beta.10
@@ -32,4 +32,4 @@ #!/usr/bin/env node | ||
}; | ||
const onDone = async (config2) => { | ||
if (!config2.hooks?.done) { | ||
const onDone = async (hooks) => { | ||
if (!hooks?.done) { | ||
return; | ||
@@ -39,6 +39,6 @@ } | ||
let commands = []; | ||
if (typeof config2.hooks?.done === "string") { | ||
commands = [config2.hooks.done]; | ||
if (typeof hooks?.done === "string") { | ||
commands = [hooks.done]; | ||
} else { | ||
commands = config2.hooks.done; | ||
commands = hooks.done; | ||
} | ||
@@ -54,9 +54,10 @@ const promises = commands.map(async (command) => { | ||
spinner2.start("\u{1F680} Building"); | ||
const { root, ...userConfig } = config; | ||
await build({ | ||
config: { | ||
root: process.cwd(), | ||
...config, | ||
...userConfig, | ||
output: { | ||
write: true, | ||
...config.output | ||
...userConfig.output | ||
} | ||
@@ -67,3 +68,3 @@ }, | ||
spinner2.succeed(pc3.blue("\u{1F308} Generation complete")); | ||
await onDone(config); | ||
await onDone(config.hooks); | ||
} catch (err) { | ||
@@ -184,3 +185,3 @@ if (options.debug) { | ||
// package.json | ||
var version = "1.0.0-beta.9"; | ||
var version = "1.0.0-beta.10"; | ||
@@ -187,0 +188,0 @@ // src/index.ts |
{ | ||
"name": "@kubb/cli", | ||
"version": "1.0.0-beta.9", | ||
"version": "1.0.0-beta.10", | ||
"description": "Generator cli", | ||
@@ -36,3 +36,3 @@ "repository": { | ||
"@humanwhocodes/module-importer": "^1.0.1", | ||
"@kubb/core": "1.0.0-beta.9", | ||
"@kubb/core": "1.0.0-beta.10", | ||
"chokidar": "^3.5.3", | ||
@@ -48,6 +48,6 @@ "commander": "^10.0.0", | ||
"ts-node": "^10.9.1", | ||
"@swc/core": "^1.3.44" | ||
"@swc/core": "^1.3.46" | ||
}, | ||
"devDependencies": { | ||
"@kubb/swagger": "1.0.0-beta.9", | ||
"@kubb/swagger": "1.0.0-beta.10", | ||
"@types/node": "^18.15.11", | ||
@@ -54,0 +54,0 @@ "@types/lodash.isobject": "^3.0.7", |
@@ -7,3 +7,3 @@ /* eslint-disable no-console */ | ||
import { build } from '@kubb/core' | ||
import type { Logger, CLIOptions, KubbUserConfig } from '@kubb/core' | ||
import type { Logger, CLIOptions, KubbConfig } from '@kubb/core' | ||
@@ -13,3 +13,3 @@ import type { Ora } from 'ora' | ||
type RunProps = { | ||
config: KubbUserConfig | ||
config: KubbConfig | ||
spinner: Ora | ||
@@ -39,4 +39,4 @@ options: CLIOptions | ||
const onDone = async (config: KubbUserConfig) => { | ||
if (!config.hooks?.done) { | ||
const onDone = async (hooks: KubbConfig['hooks']) => { | ||
if (!hooks?.done) { | ||
return | ||
@@ -47,6 +47,6 @@ } | ||
let commands: string[] = [] | ||
if (typeof config.hooks?.done === 'string') { | ||
commands = [config.hooks.done] | ||
if (typeof hooks?.done === 'string') { | ||
commands = [hooks.done] | ||
} else { | ||
commands = config.hooks.done | ||
commands = hooks.done | ||
} | ||
@@ -67,9 +67,12 @@ | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars, unused-imports/no-unused-vars | ||
const { root, ...userConfig } = config | ||
await build({ | ||
config: { | ||
root: process.cwd(), | ||
...config, | ||
...userConfig, | ||
output: { | ||
write: true, | ||
...config.output, | ||
...userConfig.output, | ||
}, | ||
@@ -82,3 +85,3 @@ }, | ||
await onDone(config) | ||
await onDone(config.hooks) | ||
} catch (err) { | ||
@@ -85,0 +88,0 @@ if (options.debug) { |
@@ -1,2 +0,2 @@ | ||
import type { KubbUserConfig, CLIOptions } from '@kubb/core' | ||
import type { KubbUserConfig, KubbConfig, CLIOptions } from '@kubb/core' | ||
import { isPromise } from '@kubb/core' | ||
@@ -8,3 +8,3 @@ | ||
export async function getConfig(result: CosmiconfigResult, options: CLIOptions) { | ||
export async function getConfig(result: CosmiconfigResult, options: CLIOptions): Promise<KubbConfig> { | ||
const config = result?.config | ||
@@ -28,3 +28,3 @@ let kubbUserConfig: Promise<KubbUserConfig> = Promise.resolve(config) as Promise<KubbUserConfig> | ||
return JSONConfig | ||
return JSONConfig as KubbConfig | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
58106
685
+ Added@kubb/core@1.0.0-beta.10(transitive)
- Removed@kubb/core@1.0.0-beta.9(transitive)
Updated@kubb/core@1.0.0-beta.10
Updated@swc/core@^1.3.46