add stats to the console output
This commit is contained in:
@@ -10,6 +10,9 @@ module.exports = function (api) {
|
|||||||
cwd: process.cwd(),
|
cwd: process.cwd(),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
let numberOfPages = 0
|
||||||
|
let numberOfDemos = 0
|
||||||
|
|
||||||
api.loadSource(() => {
|
api.loadSource(() => {
|
||||||
/**
|
/**
|
||||||
* Generate pages for all demo components for testing purposes
|
* Generate pages for all demo components for testing purposes
|
||||||
@@ -28,6 +31,8 @@ module.exports = function (api) {
|
|||||||
demos.push(match[1])
|
demos.push(match[1])
|
||||||
})
|
})
|
||||||
|
|
||||||
|
numberOfDemos = demos.length
|
||||||
|
|
||||||
api.createPages(({ createPage }) => {
|
api.createPages(({ createPage }) => {
|
||||||
createPage({
|
createPage({
|
||||||
path: '/demos',
|
path: '/demos',
|
||||||
@@ -76,8 +81,16 @@ module.exports = function (api) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
api.onCreateNode(options => {
|
api.onCreateNode(options => {
|
||||||
if (process.env.NODE_ENV === 'production' && options.internal.typeName === 'DocPage') {
|
if (options.internal.typeName === 'DocPage') {
|
||||||
|
numberOfPages += 1
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
createSpecificOpenGraphImage(options.title, options.content, `static/images${options.path}og-image.png`)
|
createSpecificOpenGraphImage(options.title, options.content, `static/images${options.path}og-image.png`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
api.configureServer(() => {
|
||||||
|
console.log(`[STATS] ${numberOfPages} pages, ${numberOfDemos} interactive demos`)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user