Files
cap/checkpoints/move_template.js
T

21 lines
531 B
JavaScript

import fs from "node:fs/promises";
const template = await fs.readFile("./template.html", "utf-8");
const folders = (await fs.readdir("./", { withFileTypes: true }))
.filter((dirent) => dirent.isDirectory())
.map((dirent) => dirent.name);
console.log(
`build command:\n${folders
.map((folder) => `cd ${folder} && bun publish --access public && cd ..`)
.join("\n")}\n`,
);
folders.forEach(async (folder) => {
const path = `./${folder}/index.html`;
await fs.writeFile(path, template);
console.log(`wrote ${path}`);
});