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.
--spa Launch in SPA mode
--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)
--help, -h Displays this message
`)
@ -63,15 +64,16 @@ const close = () => {
process.exit(0)
}
if (options.mode !== 'spa') {
// -- Build only --
if (options.mode !== 'spa' || argv.generate === false) {
// Build only
builder
.build()
.then(() => close())
.catch(error => consola.fatal(error))
} else {
// Generate dist for SPA static deployment
new Generator(nuxt, builder).generate({ build: true }).then(() => {
close()
})
// Build + Generate for static deployment
new Generator(nuxt, builder)
.generate({ build: true })
.then(() => close())
.catch(error => consola.fatal(error))
}