feat(builder): show compile logs with minimalCLI

This commit is contained in:
Pooya Parsa 2018-03-23 20:28:31 +04:30
parent d7956d5fd4
commit c82a8907e5

View File

@ -485,6 +485,12 @@ export default class Builder {
return new Promise(async (resolve, reject) => {
const name = compiler.options.name
const shouldLog = this.options.minimalCLI && !this.options.test && !this.options.dev
if (shouldLog) {
this.spinner.start('Compiling ' + name + '...')
}
await this.nuxt.callHook('build:compile', { name, compiler })
// Load renderer resources after build
@ -523,10 +529,20 @@ export default class Builder {
return reject(err)
} else if (stats.hasErrors()) {
if (this.options.test) {
err = stats.toString({ colors: true })
err = stats.toString(this.options.build.stats)
}
if (shouldLog) {
this.spinner.error('Compiled ' + name + ' with some errors')
}
return reject(err)
}
if (shouldLog) {
this.spinner.succeed('Compiled ' + name)
}
resolve()
})
}