Skip to content

Commit

Permalink
fix(cli): improve error output (#3263)
Browse files Browse the repository at this point in the history
Co-authored-by: Paul Moss <paulmoss06@gmail.com>
  • Loading branch information
paulm17 and Paul Moss committed Oct 24, 2023
1 parent d4e3fad commit bcb3dbb
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,18 @@ export async function build(_options: CliOptions) {
}),
)

if (!options.stdout) {
consola.log(green(`${name} v${version}`))
consola.start(`UnoCSS ${options.watch ? 'in watch mode...' : 'for production...'}`)
if (options.stdout && options.outFile) {
consola.fatal(`Cannot use --stdout and --out-file at the same time`)
return
}

consola.log(green(`${name} v${version}`))

if (options.watch)
consola.start('UnoCSS in watch mode...')
else
consola.start('UnoCSS for production...')

const debouncedBuild = debounce(
async () => {
generate(options).catch(handleError)
Expand All @@ -61,7 +68,7 @@ export async function build(_options: CliOptions) {
)

const startWatcher = async () => {
if (options.stdout || !options.watch)
if (!options.watch)
return
const { patterns } = options

Expand Down

0 comments on commit bcb3dbb

Please sign in to comment.