From 04e53b0f9f50d2fc95de046b55f68147b617ff8e Mon Sep 17 00:00:00 2001 From: Alexander Lichter Date: Sun, 12 Aug 2018 11:43:30 +0200 Subject: [PATCH] feat: add --quite mode for nuxt-build (#3700) * feat: add quite mode for nuxt-build * fix: typoe * fix: better description * revert: level change in options --- bin/nuxt-build | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/nuxt-build b/bin/nuxt-build index 83463fa97d..6d21276e93 100755 --- a/bin/nuxt-build +++ b/bin/nuxt-build @@ -10,9 +10,10 @@ const argv = parseArgs(process.argv.slice(2), { c: 'config-file', a: 'analyze', s: 'spa', - u: 'universal' + u: 'universal', + q: 'quiet' }, - boolean: ['h', 'a', 's', 'u'], + boolean: ['h', 'a', 's', 'u', 'q'], string: ['c'], default: { c: 'nuxt.config.js' @@ -27,10 +28,11 @@ if (argv.help) { $ nuxt build Options --analyze, -a Launch webpack-bundle-analyzer to optimize your bundles. - --spa Launch in SPA mode - --universal Launch in Universal mode (default) + --spa, -s Launch in SPA mode + --universal, -u Launch in Universal mode (default) --no-generate Don't generate static version for SPA mode (useful for nuxt start) --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js) + --quiet, -q Disable output except for errors --help, -h Displays this message `) process.exit(0) @@ -47,6 +49,12 @@ if (argv.analyze && typeof options.build.analyze !== 'object') { options.build.analyze = true } +// Silence output when using --quiet +if (argv.quiet) { + options.test = true + consola.level = 0 +} + const nuxt = new Nuxt(options) const builder = new Builder(nuxt)