diff --git a/tool/cli.ts b/tool/cli.ts index 23e12f46bceb..4f70d2a3a9a6 100644 --- a/tool/cli.ts +++ b/tool/cli.ts @@ -8,6 +8,7 @@ import { fdir, PathsOutput } from "fdir"; import frontmatter from "front-matter"; import caporal from "@caporal/core"; import chalk from "chalk"; +import cliProgress from "cli-progress"; import inquirer from "inquirer"; import openEditor from "open-editor"; import open from "open"; @@ -752,15 +753,28 @@ program const allDocs = await Document.findAll({ locales: new Map([[locale.toLowerCase(), true]]), }); + const progressBar = new cliProgress.SingleBar( + {}, + cliProgress.Presets.shades_grey + ); + progressBar.start(allDocs.count, 0); + for (const document of allDocs.iterDocs()) { - if (fileTypes.includes(document.isMarkdown ? "md" : "html")) { - await buildDocument(document, { - fixFlaws: true, - fixFlawsTypes: new Set(fixFlawsTypes), - fixFlawsVerbose: true, - }); + try { + if (fileTypes.includes(document.isMarkdown ? "md" : "html")) { + await buildDocument(document, { + fixFlaws: true, + fixFlawsTypes: new Set(fixFlawsTypes), + fixFlawsVerbose: true, + }); + } + } catch (e) { + console.error(e); } + progressBar.increment(); } + + progressBar.stop(); }) )