@kubb/cli 3.0.0-alpha.1 → 3.0.0-alpha.11

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/cli",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-alpha.11",
4
4
  "description": "Generator cli",
5
5
  "keywords": [
6
6
  "typescript",
@@ -18,9 +18,6 @@
18
18
  "author": "Stijn Van Hulle <stijn@stijnvanhulle.be",
19
19
  "sideEffects": false,
20
20
  "type": "module",
21
- "main": "dist/index.cjs",
22
- "module": "dist/index.js",
23
- "types": "./dist/index.d.ts",
24
21
  "exports": {
25
22
  ".": {
26
23
  "import": "./dist/index.js",
@@ -28,9 +25,12 @@
28
25
  "default": "./dist/index.cjs"
29
26
  }
30
27
  },
28
+ "main": "dist/index.cjs",
29
+ "module": "dist/index.js",
30
+ "types": "./dist/index.d.ts",
31
31
  "bin": {
32
- "kubb": "bin/kubb.cjs",
33
- "bkubb": "bin/bkubb.cjs"
32
+ "bkubb": "bin/bkubb.cjs",
33
+ "kubb": "bin/kubb.cjs"
34
34
  },
35
35
  "files": [
36
36
  "src",
@@ -43,28 +43,30 @@
43
43
  "bundle-require": "^5.0.0",
44
44
  "chokidar": "^3.6.0",
45
45
  "citty": "^0.1.6",
46
+ "cli-progress": "^3.12.0",
46
47
  "consola": "^3.2.3",
47
48
  "cosmiconfig": "^9.0.0",
48
49
  "esbuild": "^0.23.1",
49
50
  "execa": "^9.3.1",
50
51
  "js-runtime": "^0.0.8",
51
52
  "latest-version": "^9.0.0",
52
- "ora": "^8.0.1",
53
+ "p-queue": "^8.0.1",
53
54
  "semver": "^7.6.3",
54
55
  "string-argv": "^0.3.2",
55
56
  "tinyrainbow": "^1.2.0",
56
- "@kubb/core": "3.0.0-alpha.1",
57
- "@kubb/fs": "3.0.0-alpha.1"
57
+ "@kubb/core": "3.0.0-alpha.11",
58
+ "@kubb/fs": "3.0.0-alpha.11"
58
59
  },
59
60
  "devDependencies": {
60
- "@types/node": "^20.16.1",
61
+ "@types/cli-progress": "^3.11.6",
62
+ "@types/node": "^20.16.2",
61
63
  "@types/semver": "^7.5.8",
62
64
  "source-map-support": "^0.5.21",
63
65
  "tsup": "^8.2.4",
64
66
  "typescript": "^5.5.4",
65
- "@kubb/config-ts": "3.0.0-alpha.1",
66
- "@kubb/config-tsup": "3.0.0-alpha.1",
67
- "@kubb/plugin-oas": "3.0.0-alpha.1"
67
+ "@kubb/config-ts": "3.0.0-alpha.11",
68
+ "@kubb/config-tsup": "3.0.0-alpha.11",
69
+ "@kubb/plugin-oas": "3.0.0-alpha.11"
68
70
  },
69
71
  "engines": {
70
72
  "node": ">=20"
@@ -1,16 +1,15 @@
1
- import { LogLevel } from '@kubb/core/logger'
2
1
  import { defineCommand, showUsage } from 'citty'
3
2
  import type { ArgsDef, ParsedArgs } from 'citty'
4
3
  import { execa } from 'execa'
5
4
  import c from 'tinyrainbow'
6
5
 
7
- import path from 'node:path'
8
6
  import { getConfig } from '../utils/getConfig.ts'
9
7
  import { getCosmiConfig } from '../utils/getCosmiConfig.ts'
10
- import { spinner } from '../utils/spinner.ts'
11
8
  import { startWatcher } from '../utils/watcher.ts'
12
9
 
10
+ import path from 'node:path'
13
11
  import { PromiseManager, isInputPath } from '@kubb/core'
12
+ import { LogMapper, createLogger } from '@kubb/core/logger'
14
13
  import { generate } from '../generate.ts'
15
14
 
16
15
  const args = {
@@ -23,8 +22,8 @@ const args = {
23
22
  type: 'string',
24
23
  description: 'Info, silent or debug',
25
24
  alias: 'l',
26
- default: LogLevel.info,
27
- valueHint: `${LogLevel.silent}|${LogLevel.info}|${LogLevel.debug}`,
25
+ default: 'info',
26
+ valueHint: 'silent|info|debug',
28
27
  },
29
28
  watch: {
30
29
  type: 'boolean',
@@ -60,9 +59,6 @@ const command = defineCommand({
60
59
  description: "[input] Generate files based on a 'kubb.config.ts' file",
61
60
  },
62
61
  args,
63
- setup() {
64
- spinner.start('🔍 Loading config')
65
- },
66
62
  async run({ args }) {
67
63
  const input = args._[0]
68
64
 
@@ -72,7 +68,7 @@ const command = defineCommand({
72
68
  }
73
69
 
74
70
  if (args.debug) {
75
- args.logLevel = LogLevel.debug
71
+ args.logLevel = 'debug'
76
72
  }
77
73
 
78
74
  if (args.bun) {
@@ -82,8 +78,15 @@ const command = defineCommand({
82
78
  return
83
79
  }
84
80
 
81
+ const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3
82
+ const logger = createLogger({
83
+ logLevel,
84
+ })
85
+
86
+ logger.emit('start', 'Loading config')
87
+
85
88
  const result = await getCosmiConfig('kubb', args.config)
86
- spinner.succeed(`🔍 Config loaded(${c.dim(path.relative(process.cwd(), result.filepath))})`)
89
+ logger.emit('success', `Config loaded(${c.dim(path.relative(process.cwd(), result.filepath))})`)
87
90
 
88
91
  const config = await getConfig(result, args)
89
92
 
@@ -94,9 +97,8 @@ const command = defineCommand({
94
97
 
95
98
  if (isInputPath(config)) {
96
99
  return startWatcher([input || config.input.path], async (paths) => {
97
- await generate({ config, args })
98
- spinner.spinner = 'simpleDotsScrolling'
99
- spinner.start(c.yellow(c.bold(`Watching for changes in ${paths.join(' and ')}`)))
100
+ await generate({ config, args, input })
101
+ logger.emit('start', c.yellow(c.bold(`Watching for changes in ${paths.join(' and ')}`)))
100
102
  })
101
103
  }
102
104
  }
package/src/generate.ts CHANGED
@@ -1,16 +1,15 @@
1
- import { LogLevel, LogMapper, createLogger, randomCliColour } from '@kubb/core/logger'
1
+ import { LogMapper } from '@kubb/core/logger'
2
2
 
3
3
  import c from 'tinyrainbow'
4
4
 
5
- import { spinner } from './utils/spinner.ts'
6
-
7
- import { type Config, Warning, safeBuild } from '@kubb/core'
8
- import { createConsola } from 'consola'
9
- import type { Args } from './commands/generate.ts'
5
+ import { type Config, safeBuild } from '@kubb/core'
10
6
  import { executeHooks } from './utils/executeHooks.ts'
11
7
  import { getErrorCauses } from './utils/getErrorCauses.ts'
12
8
  import { getSummary } from './utils/getSummary.ts'
13
- import { writeLog } from './utils/writeLog.ts'
9
+
10
+ import { Presets, SingleBar } from 'cli-progress'
11
+ import type { Args } from './commands/generate.ts'
12
+ import { createLogger } from '@kubb/core/logger'
14
13
 
15
14
  type GenerateProps = {
16
15
  input?: string
@@ -19,48 +18,49 @@ type GenerateProps = {
19
18
  }
20
19
 
21
20
  export async function generate({ input, config, args }: GenerateProps): Promise<void> {
22
- const logLevel = (args.logLevel as LogLevel) || LogLevel.silent
21
+ const logLevel = LogMapper[args.logLevel as keyof typeof LogMapper] || 3
23
22
  const logger = createLogger({
24
23
  logLevel,
25
24
  name: config.name,
26
- spinner,
27
- consola: createConsola({
28
- level: LogMapper[logLevel] || 3,
29
- }),
30
25
  })
26
+ const { root = process.cwd(), ...userConfig } = config
27
+ const inputPath = input ?? ('path' in userConfig.input ? userConfig.input.path : undefined)
31
28
 
32
- logger.on('debug', async (messages: string[]) => {
33
- if (logLevel === LogLevel.debug) {
34
- await writeLog(messages.join('\n'))
35
- }
36
- })
37
-
38
- logger.consola?.wrapConsole()
39
-
40
- if (logger.name) {
41
- spinner.prefixText = randomCliColour(logger.name)
42
- }
43
-
44
- const hrstart = process.hrtime()
45
-
46
- if (args.logLevel === LogLevel.debug) {
47
- const { performance, PerformanceObserver } = await import('node:perf_hooks')
29
+ if (logger.logLevel !== LogMapper.debug) {
30
+ const progressCache = new Map<string, SingleBar>()
31
+
32
+ logger.on('progress_start', ({ id, size, message = '' }) => {
33
+ logger.consola?.pauseLogs()
34
+ const payload = { id, message }
35
+ const progressBar = new SingleBar(
36
+ {
37
+ format: '{percentage}% {bar} {value}/{total} | {message}',
38
+ barsize: 30,
39
+ clearOnComplete: true,
40
+ emptyOnZero: true,
41
+ },
42
+ Presets.shades_grey,
43
+ )
44
+
45
+ if (!progressCache.has(id)) {
46
+ progressCache.set(id, progressBar)
47
+ progressBar.start(size, 1, payload)
48
+ }
49
+ })
48
50
 
49
- const performanceOpserver = new PerformanceObserver((items) => {
50
- const message = `${items.getEntries()[0]?.duration.toFixed(0)}ms`
51
+ logger.on('progress_stop', ({ id }) => {
52
+ progressCache.get(id)?.stop()
53
+ logger.consola?.resumeLogs()
54
+ })
51
55
 
52
- spinner.suffixText = c.yellow(message)
56
+ logger.on('progressed', ({ id, message = '' }) => {
57
+ const payload = { id, message }
53
58
 
54
- performance.clearMarks()
59
+ progressCache.get(id)?.increment(1, payload)
55
60
  })
56
-
57
- performanceOpserver.observe({ type: 'measure' })
58
61
  }
59
62
 
60
- const { root = process.cwd(), ...userConfig } = config
61
- const inputPath = input ?? ('path' in userConfig.input ? userConfig.input.path : undefined)
62
-
63
- spinner.start(`🚀 Building ${logLevel !== 'silent' ? c.dim(inputPath) : ''}`)
63
+ logger.emit('start', `Building ${logger.logLevel !== LogMapper.silent ? c.dim(inputPath) : ''}`)
64
64
 
65
65
  const definedConfig: Config = {
66
66
  root,
@@ -73,37 +73,50 @@ export async function generate({ input, config, args }: GenerateProps): Promise<
73
73
  : userConfig.input,
74
74
  output: {
75
75
  write: true,
76
+ exportType: 'barrelNamed',
76
77
  ...userConfig.output,
77
78
  },
78
79
  }
79
- const { pluginManager, error } = await safeBuild({
80
+ const hrStart = process.hrtime()
81
+ const { pluginManager, files, error } = await safeBuild({
80
82
  config: definedConfig,
81
83
  logger,
82
84
  })
83
85
 
86
+ if (logger.logLevel === LogMapper.debug) {
87
+ logger.consola?.start('Writing logs')
88
+
89
+ const logFiles = await logger.writeLogs()
90
+
91
+ logger.consola?.success(`Written logs: \n${logFiles.join('\n')}`)
92
+ }
93
+
84
94
  const summary = getSummary({
95
+ filesCreated: files.length,
85
96
  pluginManager,
86
97
  config: definedConfig,
87
98
  status: error ? 'failed' : 'success',
88
- hrstart,
89
- logger,
99
+ hrStart,
90
100
  })
91
101
 
92
- if (error) {
93
- spinner.suffixText = ''
94
- spinner.fail(`🚀 Build failed ${logLevel !== 'silent' ? c.dim(inputPath) : ''}`)
95
-
96
- console.log(summary.join(''))
97
-
98
- if (error instanceof Warning) {
99
- spinner.warn(c.yellow(error.message))
100
- process.exit(0)
101
- }
102
+ if (error && logger.consola) {
103
+ logger.consola?.resumeLogs()
104
+ logger.consola.error(`Build failed ${logger.logLevel !== LogMapper.silent ? c.dim(inputPath) : ''}`)
105
+
106
+ logger.consola.box({
107
+ title: `${config.name || ''}`,
108
+ message: summary.join(''),
109
+ style: {
110
+ padding: 2,
111
+ borderColor: 'red',
112
+ borderStyle: 'rounded',
113
+ },
114
+ })
102
115
 
103
116
  const errors = getErrorCauses([error])
104
- if (logger.consola && errors.length && logLevel === LogLevel.debug) {
117
+ if (logger.consola && errors.length && logger.logLevel === LogMapper.debug) {
105
118
  errors.forEach((err) => {
106
- logger.consola!.error(err)
119
+ logger.consola?.error(err)
107
120
  })
108
121
  }
109
122
 
@@ -112,10 +125,19 @@ export async function generate({ input, config, args }: GenerateProps): Promise<
112
125
  process.exit(0)
113
126
  }
114
127
 
115
- await executeHooks({ hooks: config.hooks, logLevel })
128
+ if (config.hooks) {
129
+ await executeHooks({ hooks: config.hooks, logger })
130
+ }
116
131
 
117
- spinner.suffixText = ''
118
- spinner.succeed(`🚀 Build completed ${logLevel !== 'silent' ? c.dim(inputPath) : ''}`)
132
+ logger.consola?.log(`⚡Build completed ${logger.logLevel !== LogMapper.silent ? c.dim(inputPath) : ''}`)
119
133
 
120
- console.log(summary.join(''))
134
+ logger.consola?.box({
135
+ title: `${config.name || ''}`,
136
+ message: summary.join(''),
137
+ style: {
138
+ padding: 2,
139
+ borderColor: 'green',
140
+ borderStyle: 'rounded',
141
+ },
142
+ })
121
143
  }
package/src/index.ts CHANGED
@@ -2,8 +2,8 @@ import { defineCommand, runCommand, runMain } from 'citty'
2
2
  import getLatestVersion from 'latest-version'
3
3
  import { lt } from 'semver'
4
4
 
5
- import consola from 'consola'
6
5
  import { version } from '../package.json'
6
+ import consola from 'consola'
7
7
 
8
8
  const name = 'kubb'
9
9
 
@@ -0,0 +1,23 @@
1
+ import { Writable } from 'node:stream'
2
+
3
+ import c from 'tinyrainbow'
4
+
5
+ import * as process from 'node:process'
6
+ import type { WritableOptions } from 'node:stream'
7
+ import type { ConsolaInstance } from 'consola'
8
+
9
+ export class ConsolaWritable extends Writable {
10
+ consola: ConsolaInstance | undefined
11
+ command: string
12
+ constructor(consola: ConsolaInstance | undefined, command: string, opts?: WritableOptions) {
13
+ super(opts)
14
+
15
+ this.command = command
16
+ this.consola = consola
17
+ }
18
+ _write(chunk: any, _encoding: BufferEncoding, callback: (error?: Error | null) => void): void {
19
+ process.stdout.write(`${c.dim(chunk?.toString())}`)
20
+
21
+ callback()
22
+ }
23
+ }
@@ -1,65 +1,45 @@
1
- import { LogLevel } from '@kubb/core/logger'
1
+ import type { Logger } from '@kubb/core/logger'
2
2
  import { execa } from 'execa'
3
3
  import { parseArgsStringToArgv } from 'string-argv'
4
4
  import c from 'tinyrainbow'
5
5
 
6
- import { OraWritable } from './OraWritable.ts'
7
- import { spinner } from './spinner.ts'
6
+ import { ConsolaWritable } from './Writables.ts'
8
7
 
9
- import type { Writable } from 'node:stream'
10
8
  import type { Config } from '@kubb/core'
9
+ import { LogMapper } from '@kubb/core/logger'
10
+ import PQueue from 'p-queue'
11
11
 
12
12
  type ExecutingHooksProps = {
13
- hooks: Config['hooks']
14
- logLevel: LogLevel
13
+ hooks: NonNullable<Config['hooks']>
14
+ logger: Logger
15
15
  }
16
16
 
17
- export async function executeHooks({ hooks, logLevel }: ExecutingHooksProps): Promise<void> {
18
- if (!hooks?.done) {
19
- return
20
- }
17
+ export async function executeHooks({ hooks, logger }: ExecutingHooksProps): Promise<void> {
18
+ const commands = Array.isArray(hooks.done) ? hooks.done : [hooks.done].filter(Boolean)
19
+ const queue = new PQueue({ concurrency: 1 })
21
20
 
22
- const commands = Array.isArray(hooks.done) ? hooks.done : [hooks.done]
21
+ const promises = commands.map(async (command) => {
22
+ const consolaWritable = new ConsolaWritable(logger.consola!, command)
23
+ const [cmd, ..._args] = [...parseArgsStringToArgv(command)]
23
24
 
24
- if (logLevel === LogLevel.silent) {
25
- spinner.start('Executing hooks')
26
- }
25
+ if (!cmd) {
26
+ return null
27
+ }
27
28
 
28
- const executers = commands
29
- .map(async (command) => {
30
- const oraWritable = new OraWritable(spinner, command)
31
- const abortController = new AbortController()
32
- const [cmd, ..._args] = [...parseArgsStringToArgv(command)]
29
+ await queue.add(async () => {
30
+ logger?.emit('start', `Executing hook ${logger.logLevel !== LogMapper.silent ? c.dim(command) : ''}`)
33
31
 
34
- if (!cmd) {
35
- return null
36
- }
37
-
38
- spinner.start(`Executing hook ${logLevel !== 'silent' ? c.dim(command) : ''}`)
39
-
40
- const subProcess = await execa(cmd, _args, {
32
+ await execa(cmd, _args, {
41
33
  detached: true,
42
- cancelSignal: abortController.signal,
43
- stdout: ['pipe', oraWritable],
34
+ stdout: logger?.logLevel === LogMapper.silent ? undefined : ['pipe', consolaWritable],
35
+ stripFinalNewline: true,
44
36
  })
45
- spinner.suffixText = ''
46
-
47
- if (logLevel === LogLevel.silent) {
48
- spinner.succeed(`Executing hook ${logLevel !== 'silent' ? c.dim(command) : ''}`)
49
-
50
- if (subProcess) {
51
- console.log(subProcess.stdout)
52
- }
53
- }
54
37
 
55
- oraWritable.destroy()
56
- return { subProcess, abort: abortController.abort.bind(abortController) }
38
+ logger?.emit('success', `Executed hook ${logger.logLevel !== LogMapper.silent ? c.dim(command) : ''}`)
57
39
  })
58
- .filter(Boolean)
40
+ })
59
41
 
60
- await Promise.all(executers)
42
+ await Promise.all(promises)
61
43
 
62
- if (logLevel === LogLevel.silent) {
63
- spinner.succeed('Executing hooks')
64
- }
44
+ logger?.emit('success', 'Executed hooks')
65
45
  }
@@ -1,5 +1,3 @@
1
- import { PackageManager } from '@kubb/core'
2
-
3
1
  import type { UserConfig } from '@kubb/core'
4
2
 
5
3
  function isJSONPlugins(plugins: UserConfig['plugins']) {
@@ -12,14 +10,6 @@ function isObjectPlugins(plugins: UserConfig['plugins']): plugins is any {
12
10
  return plugins instanceof Object && !Array.isArray(plugins)
13
11
  }
14
12
 
15
- async function importPlugin(name: string, options: object): Promise<UserConfig['plugins']> {
16
- const packageManager = new PackageManager(process.cwd())
17
-
18
- const importedPlugin: any = process.env.NODE_ENV === 'test' ? await import(name) : await packageManager.import(name)
19
-
20
- return importedPlugin?.default ? importedPlugin.default(options) : importedPlugin(options)
21
- }
22
-
23
13
  export function getPlugins(plugins: UserConfig['plugins']): Promise<UserConfig['plugins']> {
24
14
  if (isObjectPlugins(plugins)) {
25
15
  throw new Error('Object plugins are not supported anymore, best to use http://kubb.dev/getting-started/configure#json')
@@ -7,20 +7,18 @@ import c from 'tinyrainbow'
7
7
  import { parseHrtimeToSeconds } from './parseHrtimeToSeconds.ts'
8
8
 
9
9
  import type { Config, PluginManager } from '@kubb/core'
10
- import type { Logger } from '@kubb/core/logger'
11
10
 
12
11
  type SummaryProps = {
13
12
  pluginManager: PluginManager
14
13
  status: 'success' | 'failed'
15
- hrstart: [number, number]
14
+ hrStart: [number, number]
15
+ filesCreated: number
16
16
  config: Config
17
- logger: Logger
18
17
  }
19
18
 
20
- export function getSummary({ pluginManager, status, hrstart, config, logger }: SummaryProps): string[] {
21
- const { logLevel } = logger
19
+ export function getSummary({ pluginManager, filesCreated, status, hrStart, config }: SummaryProps): string[] {
22
20
  const logs: string[] = []
23
- const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrstart))
21
+ const elapsedSeconds = parseHrtimeToSeconds(process.hrtime(hrStart))
24
22
 
25
23
  const buildStartPlugins = pluginManager.executed
26
24
  .filter((item) => item.hookName === 'buildStart' && item.plugin.name !== 'core')
@@ -30,48 +28,24 @@ export function getSummary({ pluginManager, status, hrstart, config, logger }: S
30
28
 
31
29
  const failedPlugins = config.plugins?.filter((plugin) => !buildEndPlugins.includes(plugin.name))?.map((plugin) => plugin.name)
32
30
  const pluginsCount = config.plugins?.length || 0
33
- const files = pluginManager.fileManager.files.sort((a, b) => {
34
- if (!a.meta?.pluginKey?.[0] || !b.meta?.pluginKey?.[0]) {
35
- return 0
36
- }
37
- if (a.meta?.pluginKey?.[0]?.length < b.meta?.pluginKey?.[0]?.length) {
38
- return 1
39
- }
40
- if (a.meta?.pluginKey?.[0]?.length > b.meta?.pluginKey?.[0]?.length) {
41
- return -1
42
- }
43
- return 0
44
- })
45
31
 
46
32
  const meta = {
47
- name: config.name,
48
33
  plugins:
49
34
  status === 'success'
50
35
  ? `${c.green(`${buildStartPlugins.length} successful`)}, ${pluginsCount} total`
51
36
  : `${c.red(`${failedPlugins?.length ?? 1} failed`)}, ${pluginsCount} total`,
52
37
  pluginsFailed: status === 'failed' ? failedPlugins?.map((name) => randomCliColour(name))?.join(', ') : undefined,
53
- filesCreated: files.length,
54
- time: c.yellow(`${elapsedSeconds}s`),
55
- endTime: c.yellow(Date()),
38
+ filesCreated: filesCreated,
39
+ time: `${c.yellow(`${elapsedSeconds}s`)}`,
56
40
  output: path.isAbsolute(config.root) ? path.resolve(config.root, config.output.path) : config.root,
57
41
  } as const
58
42
 
59
- logger.emit('debug', ['\nGenerated files:\n'])
60
- logger.emit(
61
- 'debug',
62
- files.map((file) => `${randomCliColour(JSON.stringify(file.meta?.pluginKey))} ${file.path}`),
63
- )
64
-
65
43
  logs.push(
66
44
  [
67
- ['\n', true],
68
- [` ${c.bold('Name:')} ${meta.name}`, !!meta.name],
69
- [` ${c.bold('Plugins:')} ${meta.plugins}`, true],
70
- [` ${c.dim('Failed:')} ${meta.pluginsFailed || 'none'}`, !!meta.pluginsFailed],
71
- [`${c.bold('Generated:')} ${meta.filesCreated} files`, true],
72
- [` ${c.bold('Time:')} ${meta.time}`, true],
73
- [` ${c.bold('Ended:')} ${meta.endTime}`, true],
74
- [` ${c.bold('Output:')} ${meta.output}`, true],
45
+ [`${c.bold('Plugins:')} ${meta.plugins}`, true],
46
+ [`${c.dim('Failed:')} ${meta.pluginsFailed || 'none'}`, !!meta.pluginsFailed],
47
+ [`${c.bold('Generated:')} ${meta.filesCreated} files in ${meta.time}`, true],
48
+ [`${c.bold('Output:')} ${meta.output}`, true],
75
49
  ]
76
50
  .map((item) => {
77
51
  if (item.at(1)) {
@@ -1,9 +1,9 @@
1
1
  import c from 'tinyrainbow'
2
-
3
- import { spinner } from './spinner.ts'
2
+ import { createLogger } from '@kubb/core/logger'
4
3
 
5
4
  export async function startWatcher(path: string[], cb: (path: string[]) => Promise<void>): Promise<void> {
6
5
  const { watch } = await import('chokidar')
6
+ const logger = createLogger()
7
7
 
8
8
  const ignored = ['**/{.git,node_modules}/**']
9
9
 
@@ -12,14 +12,12 @@ export async function startWatcher(path: string[], cb: (path: string[]) => Promi
12
12
  ignored,
13
13
  })
14
14
  watcher.on('all', (type, file) => {
15
- spinner.succeed(c.yellow(c.bold(`Change detected: ${type} ${file}`)))
16
- // revert back
17
- spinner.spinner = 'clock'
15
+ logger?.emit('info', c.yellow(c.bold(`Change detected: ${type} ${file}`)))
18
16
 
19
17
  try {
20
18
  cb(path)
21
19
  } catch (e) {
22
- spinner.warn(c.red('Watcher failed'))
20
+ logger?.emit('warning', c.red('Watcher failed'))
23
21
  }
24
22
  })
25
23