Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
leafac committed Oct 18, 2021
1 parent 17ecf5a commit d58416b
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,18 @@ const { JSDOM } = require("jsdom");
.use(rehypeRaw)
.use(rehypeStringify);

const layoutMtime = (await fs.stat(__filename)).mtime.getTime();
for (const fileMarkdown of await globby("**/*.md", {
ignore: ["node_modules", "Media", "migration", "README.md"],
})) {
const fileHTML = `${fileMarkdown.slice(0, -".md".length)}.html`;
if (
fs.existsSync(fileHTML) &&
(await fs.stat(fileMarkdown)).mtime.getTime() <
Math.max((await fs.stat(fileMarkdown)).mtime.getTime(), layoutMtime) <
(await fs.stat(fileHTML)).mtime.getTime()
)
continue;
console.log(`Starting ‘${fileMarkdown}’ → ‘${fileHTML}’...`);
process.stdout.write(`Starting ‘${fileMarkdown}’ → ‘${fileHTML}’...`);
await fs.ensureDir(path.dirname(fileMarkdown));
const dom = new JSDOM(
await layout({
Expand All @@ -441,5 +442,6 @@ const { JSDOM } = require("jsdom");
></iframe>
`;
await fs.writeFile(fileHTML, dom.serialize());
console.log(" Done.");
}
})();

0 comments on commit d58416b

Please sign in to comment.