mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-21 07:59:33 +00:00
logs for generator
This commit is contained in:
parent
fdfd7aa32d
commit
ca525200ca
@ -10,6 +10,7 @@ const _ = require('lodash')
|
|||||||
const { resolve, join, dirname, sep } = require('path')
|
const { resolve, join, dirname, sep } = require('path')
|
||||||
const { minify } = require('html-minifier')
|
const { minify } = require('html-minifier')
|
||||||
const Chalk = require('chalk')
|
const Chalk = require('chalk')
|
||||||
|
const ORA = require('ora')
|
||||||
const { printWarn } = require('../common/utils')
|
const { printWarn } = require('../common/utils')
|
||||||
|
|
||||||
const {
|
const {
|
||||||
@ -34,14 +35,23 @@ module.exports = class Generator {
|
|||||||
this.distPath,
|
this.distPath,
|
||||||
isUrl(this.options.build.publicPath) ? '' : this.options.build.publicPath
|
isUrl(this.options.build.publicPath) ? '' : this.options.build.publicPath
|
||||||
)
|
)
|
||||||
|
|
||||||
|
this.spinner = new ORA()
|
||||||
}
|
}
|
||||||
|
|
||||||
async generate({ build = true, init = true } = {}) {
|
async generate({ build = true, init = true } = {}) {
|
||||||
|
this.spinner.start('Initializing generator...')
|
||||||
|
|
||||||
await this.initiate({ build, init })
|
await this.initiate({ build, init })
|
||||||
|
|
||||||
|
this.spinner.start('Preparing routes for generate...')
|
||||||
|
|
||||||
const routes = await this.initRoutes()
|
const routes = await this.initRoutes()
|
||||||
|
|
||||||
|
this.spinner.start('Generating pages...')
|
||||||
|
|
||||||
const errors = await this.generateRoutes(routes)
|
const errors = await this.generateRoutes(routes)
|
||||||
|
|
||||||
await this.afterGenerate()
|
await this.afterGenerate()
|
||||||
|
|
||||||
// Done hook
|
// Done hook
|
||||||
@ -221,6 +231,8 @@ module.exports = class Generator {
|
|||||||
const pageErrors = []
|
const pageErrors = []
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
this.spinner.info('Generate ' + route)
|
||||||
|
|
||||||
const res = await this.nuxt.renderer.renderRoute(route, {
|
const res = await this.nuxt.renderer.renderRoute(route, {
|
||||||
_generate: true,
|
_generate: true,
|
||||||
payload
|
payload
|
||||||
|
Loading…
Reference in New Issue
Block a user