Fix warning output

This has been broken since the progress bar addition.
This commit is contained in:
Domenic Denicola 2020-11-07 16:08:25 -05:00
commit b4454f8432
2 changed files with 22 additions and 11 deletions

View file

@ -21,18 +21,23 @@ module.exports = async (cachePath, manifestPath, contentPath, book, concurrentJo
}
const pool = workerpool.pool(path.resolve(__dirname, "convert-worker.js"), poolOptions);
const warnings = [];
await Promise.all(chapters.map(async chapter => {
const inputPath = path.resolve(cachePath, chapter.filename);
const destFileName = `${path.basename(chapter.filename, ".html")}.xhtml`;
const outputPath = path.resolve(contentPath, destFileName);
await pool.exec("convertChapter", [chapter, book, inputPath, outputPath]);
warnings.push(...await pool.exec("convertChapter", [chapter, book, inputPath, outputPath]));
progress.increment();
}));
pool.terminate();
for (const warning of warnings) {
console.warn(warning);
}
console.log("All chapters converted");
};