logs for generator

This commit is contained in:
Pooya Parsa 2018-03-13 20:46:12 +03:30
parent fdfd7aa32d
commit ca525200ca

View File

@ -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