Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/core/src/Site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,7 @@ class Site {
}
this.generateProgressBarStatus(progressBar, context, pageGenerationQueue, resolve);
} catch (err) {
progressBar.increment();
logger.error(err);
reject(new Error(`Error while generating ${page.pageConfig.sourcePath}`));
}
Expand Down
9 changes: 8 additions & 1 deletion packages/core/src/lib/progress/node-progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ function ProgressBar(fmt, options) {
this.callback = options.callback || function () { };
this.tokens = {};
this.lastDraw = '';
this.count = this.curr; // Extra counter to keep track of all processed pages
}

/**
Expand All @@ -120,12 +121,13 @@ ProgressBar.prototype.tick = function (len, tokens) {
if (0 == this.curr) this.start = new Date;

this.curr += len
this.count += len

// try to render
this.render();

// progress complete
if (this.curr >= this.total) {
if (this.count >= this.total) {
this.render(undefined, true);
this.complete = true;
this.terminate();
Expand All @@ -134,6 +136,11 @@ ProgressBar.prototype.tick = function (len, tokens) {
}
};

// Increment count if page failed to generate
ProgressBar.prototype.increment = function () {
this.count += 1;
}

/**
* Method to render the progress bar with optional `tokens` to place in the
* progress bar's `fmt` field.
Expand Down
20 changes: 11 additions & 9 deletions packages/core/src/utils/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,17 @@ const warnWarp = (input: any) => {
};

// create a wrapper for info messages
const infoWarp = (input: any) => {
if (progressBar) {
progressBar.interruptBegin();
winston.info(input);
progressBar.interruptEnd();
} else {
winston.info(input);
}
};
// const infoWarp = (input: any) => {
// if (progressBar) {
// progressBar.interruptBegin();
// winston.info(input);
// progressBar.interruptEnd();
// } else {
// winston.info(input);
// }
// };

const infoWarp = winston.info;

const { debug } = winston;
const { verbose } = winston;
Expand Down