mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +00:00
fix: exit with code (0) on successful nuxt-build. fixes #2569.
This commit is contained in:
parent
642cf4038a
commit
cc29b26cbe
@ -54,6 +54,7 @@ if (fs.existsSync(nuxtConfigFile)) {
|
||||
if (typeof options.rootDir !== 'string') {
|
||||
options.rootDir = rootDir
|
||||
}
|
||||
|
||||
// Create production build when calling `nuxt build`
|
||||
options.dev = false
|
||||
|
||||
@ -75,29 +76,25 @@ const builder = new Builder(nuxt)
|
||||
nuxt.hook('error', (_err, from) => Utils.fatalError(_err, from))
|
||||
|
||||
if (options.mode !== 'spa') {
|
||||
// Build for SSR app
|
||||
// -- Build for SSR app --
|
||||
builder
|
||||
.build()
|
||||
.then(() => debug('Building done'))
|
||||
.then(() => process.exit(0))
|
||||
.catch(err => {
|
||||
Utils.fatalError(err)
|
||||
})
|
||||
} else {
|
||||
// -- Build for SPA app --
|
||||
const s = Date.now()
|
||||
|
||||
nuxt.hook('generate:distRemoved', function () {
|
||||
debug('Destination folder cleaned')
|
||||
})
|
||||
nuxt.hook('generate:distRemoved', () => debug('Destination folder cleaned'))
|
||||
|
||||
nuxt.hook('generate:distCopied', function () {
|
||||
debug('Static & build files copied')
|
||||
})
|
||||
nuxt.hook('generate:distCopied', () => debug('Static & build files copied'))
|
||||
|
||||
nuxt.hook('generate:page', function (page) {
|
||||
debug('Generate file: ' + page.path)
|
||||
})
|
||||
nuxt.hook('generate:page', page => debug('Generate file: ' + page.path))
|
||||
|
||||
nuxt.hook('generate:done', function (generator, errors) {
|
||||
nuxt.hook('generate:done', (generator, errors) => {
|
||||
const duration = Math.round((Date.now() - s) / 100) / 10
|
||||
|
||||
debug(`HTML Files generated in ${duration}s`)
|
||||
@ -110,7 +107,8 @@ if (options.mode !== 'spa') {
|
||||
|
||||
// Disable minify to get exact results of nuxt start
|
||||
nuxt.options.generate.minify = false
|
||||
// Generate on spa mode
|
||||
|
||||
// Generate dist for SPA static deployment
|
||||
new Generator(nuxt, builder).generate({ build: true }).then(() => {
|
||||
process.exit(0)
|
||||
})
|
||||
|
@ -86,7 +86,7 @@ nuxt.hook('generate:done', (generator, errors) => {
|
||||
const duration = Math.round((Date.now() - s) / 100) / 10
|
||||
|
||||
debug(`HTML Files generated in ${duration}s`)
|
||||
console.log(errors.length)
|
||||
|
||||
if (errors.length) {
|
||||
/* eslint-disable no-console */
|
||||
console.log('\n Generate errors summary:')
|
||||
|
Loading…
Reference in New Issue
Block a user