feat(nuxt-build): add --generate option

This commit is contained in:
Pooya Parsa 2018-03-20 13:45:18 +03:30
parent 6a68e381b6
commit d9c2575652

View File

@ -33,6 +33,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)
--generate Generate static version after build
--config-file, -c Path to Nuxt.js config file (default: nuxt.config.js)
--help, -h Displays this message
`)
@ -65,14 +66,14 @@ const close = () => {
process.exit(0)
}
if (options.mode !== 'spa') {
// -- Build for SSR app --
if (!argv.generate) {
// -- Build only --
builder
.build()
.then(() => close())
.catch(Utils.fatalError)
} else {
// -- Build for SPA app --
// -- Build and generate --
const s = Date.now()
nuxt.hook('generate:distRemoved', () => debug('Destination folder cleaned'))
@ -92,9 +93,6 @@ if (options.mode !== 'spa') {
}
})
// Disable minify to get exact results of nuxt start
nuxt.options.generate.minify = false
// Generate dist for SPA static deployment
new Generator(nuxt, builder).generate({ build: true }).then(() => {
close()