feat: integrate joinComponents
trickyni trickyniv56@gmail.com
Thu, 30 Apr 2026 17:16:41 +0300
1 files changed,
12 insertions(+),
27 deletions(-)
jump to
M
looper.js
→
looper.js
@@ -1,31 +1,16 @@
-import { extractFrontmatter } from "./extractFrontmatter"; -import { writePage } from "./writePage"; -import { copy, emptyDir, ensureDir, writeFile, readdir } from "fs-extra"; +import { emptyDir, writeFile } from "fs-extra"; +import { joinComponents } from "./joinComponents"; import cpy from "cpy"; -import glob from "glob"; +import { glob } from "glob"; //mise en place -await emptyDir("out/", { recursive: true }); // clears the output folder -await ensureDir("out/assets"); -await cpy("./input/assets", "./out/assets", { flat: true }); +await emptyDir("out", { recursive: true }); // clears the output folder +await cpy("input/assets", "out", { flat: true }); //copies all the assets into out/ -const contentDir = await glob("./input/content/", { - nodir: true, - withFileTypes: true, -}); - -await Promise.all( - contentDir - .filter((f) => f.isFile()) - .map((f) => console.log(extractFrontmatter(f.path))), -); -// for (let file of contentDir) { -// if (file.isFile()) { -// console.log(await extractFrontmatter(file.path)); -// } -// } - -// async function indexSite() { -// const -// return -// } +for (const file of await glob("input/content/**/*", { nodir: true })) { + console.log(file); + await writeFile( + file.replace("input/content", "out").replace(".md", ".html"), + await joinComponents(file), + ); +}