feat: add --no-generate option

useful for SPA builds that don't need static dist/ to be generated
This commit is contained in:
Pooya Parsa 2018-04-15 11:11:31 +04:30
parent 7d3afb0502
commit 63fe3fd803

View File

@ -29,6 +29,7 @@ if (argv.help) {
--analyze, -a Launch webpack-bundle-analyzer to optimize your bundles. --analyze, -a Launch webpack-bundle-analyzer to optimize your bundles.
--spa Launch in SPA mode --spa Launch in SPA mode
--universal Launch in Universal mode (default) --universal 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) --config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message --help, -h Displays this message
`) `)
@ -63,15 +64,16 @@ const close = () => {
process.exit(0) process.exit(0)
} }
if (options.mode !== 'spa') { if (options.mode !== 'spa' || argv.generate === false) {
// -- Build only -- // Build only
builder builder
.build() .build()
.then(() => close()) .then(() => close())
.catch(error => consola.fatal(error)) .catch(error => consola.fatal(error))
} else { } else {
// Generate dist for SPA static deployment // Build + Generate for static deployment
new Generator(nuxt, builder).generate({ build: true }).then(() => { new Generator(nuxt, builder)
close() .generate({ build: true })
}) .then(() => close())
.catch(error => consola.fatal(error))
} }