import indexTemplate from "./generators/index.html.txt"; import workTemplate from "./generators/work.html.txt"; import readmeTemplate from "./generators/README.md.txt"; import chalk from "chalk"; export const generate = async (works: string[]) => { const allWorks = works .map((file) => file.replace("src/", "").replace("/main.ts", "")) .sort() .reverse(); for (const work of allWorks) { const html = `${workTemplate}`.replace(/##name##/g, work); await Bun.write(`html/${work}/index.html`, html); console.log(chalk.yellow(` -> html/${work}/index.html...`)); } const index = indexTemplate.replace( "", allWorks .map((work) => `