diff --git a/lib/builder/generator.js b/lib/builder/generator.js index c0057e637f..08ae96d508 100644 --- a/lib/builder/generator.js +++ b/lib/builder/generator.js @@ -10,6 +10,7 @@ const _ = require('lodash') const { resolve, join, dirname, sep } = require('path') const { minify } = require('html-minifier') const Chalk = require('chalk') +const ORA = require('ora') const { printWarn } = require('../common/utils') const { @@ -34,14 +35,23 @@ module.exports = class Generator { this.distPath, isUrl(this.options.build.publicPath) ? '' : this.options.build.publicPath ) + + this.spinner = new ORA() } async generate({ build = true, init = true } = {}) { + this.spinner.start('Initializing generator...') + await this.initiate({ build, init }) + this.spinner.start('Preparing routes for generate...') + const routes = await this.initRoutes() + this.spinner.start('Generating pages...') + const errors = await this.generateRoutes(routes) + await this.afterGenerate() // Done hook @@ -221,6 +231,8 @@ module.exports = class Generator { const pageErrors = [] try { + this.spinner.info('Generate ' + route) + const res = await this.nuxt.renderer.renderRoute(route, { _generate: true, payload