Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(generator): option to merge generate output log into single line #5517

Closed
wants to merge 5 commits into from
Closed
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

@@ -60,7 +60,8 @@ export default () => ({
concurrency: 500,
interval: 0,
subFolders: true,
fallback: '200.html'
fallback: '200.html',
mergeOutputLog: false
},

// Watch
@@ -169,6 +169,7 @@ Object {
"interval": 0,
"routes": Array [],
"subFolders": true,
"mergeOutputLog": false,
},
"globalName": "nuxt",
"globals": Object {
@@ -96,6 +96,7 @@ export default class Generator {

async generateRoutes(routes) {
const errors = []
let generatedRoutesCount = 0

// Start generate process
while (routes.length) {
@@ -105,11 +106,18 @@ export default class Generator {
.splice(0, this.options.generate.concurrency)
.map(async ({ route, payload }) => {
await waitFor(n++ * this.options.generate.interval)
await this.generateRoute({ route, payload, errors })
const routeGenerated = await this.generateRoute({ route, payload, errors })
if (routeGenerated) {
generatedRoutesCount++
}
})
)
}

if (this.options.generate.mergeOutputLog) {
consola.success('Generated ' + generatedRoutesCount + ' pages')
}

// Improve string representation for errors
// TODO: Use consola for more consistency
errors.toString = () => this._formatErrors(errors)
@@ -265,7 +273,7 @@ export default class Generator {
if (pageErrors.length) {
consola.error('Error generating ' + route)
errors.push(...pageErrors)
} else {
} else if (!this.options.generate.mergeOutputLog) {
consola.success('Generated ' + route)
}

ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.