fix the messages showing build progress

This commit is contained in:
hippoz 2021-10-18 23:25:36 +03:00
parent 9690372b01
commit b58ec951ba
No known key found for this signature in database
GPG key ID: 7C52899193467641
2 changed files with 6 additions and 3 deletions

View file

@ -70,7 +70,11 @@ const findAllPages = async (directory) =>
)
.map(f => directory + "/" + f); // TODO: hack
const buildPage = async (pagePath) => await processPageOutput(require(pagePath));
const buildPage = async (pagePath) => {
const processed = await processPageOutput(require(pagePath));
console.log(`${escapeCodes.fgGreen}${specialCharacter("→")}${escapeCodes.reset} Built ${escapeCodes.fgBlue}${path.parse(path.basename(pagePath, buildConfig.pageExtension)).name}${escapeCodes.reset}`);
return processed
};
const buildAllPages = async (directory) =>
await Promise.all((await findAllPages(directory))
@ -83,7 +87,6 @@ const exportAllPages = async (sourcePath, outputPath) => {
for (const [pagePath, pageContent] of pages) {
const pageName = path.parse(path.basename(pagePath, buildConfig.pageExtension)).name;
await fs.writeFile(path.join(outputPath, pageName + ".html"), pageContent);
console.log(`${escapeCodes.fgGreen}${specialCharacter("→")}${escapeCodes.reset} Built ${escapeCodes.fgBlue}${pageName}${escapeCodes.reset}`);
}
return pages.length;
};

View file

@ -3,7 +3,7 @@ module.exports = {
outputDirectory: "./out",
pageExtension: ".page.js",
postProcessing: {
trimOutput: false, // not very useful when beautifyOutput === true
trimOutput: false,
beautifyOutput: true,
beautifyOutputOptions: {
indent_size: 2,