From c82a8907e5b50ef187e2ad75a53c92d89f4c7a1f Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 23 Mar 2018 20:28:31 +0430 Subject: [PATCH] feat(builder): show compile logs with minimalCLI --- lib/builder/builder.mjs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/builder/builder.mjs b/lib/builder/builder.mjs index 1663f493bd..29bb69e4e4 100644 --- a/lib/builder/builder.mjs +++ b/lib/builder/builder.mjs @@ -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() }) }