generate readme too
This commit is contained in:
parent
1da90f397b
commit
59a6487d99
4 changed files with 41 additions and 12 deletions
17
generators/README.md.template
Normal file
17
generators/README.md.template
Normal file
|
@ -0,0 +1,17 @@
|
|||
# noeidelon
|
||||
|
||||
Foxes dream of electron beams.
|
||||
|
||||
https://art.mekanoe.com
|
||||
|
||||
## Development
|
||||
|
||||
`nix` to install bun... or do it globally.
|
||||
|
||||
`bun run .` to generate HTMLs
|
||||
|
||||
`bun serve` to serve them locally
|
||||
|
||||
## Artworks
|
||||
|
||||
<!--/INSERT/-->
|
|
@ -10,6 +10,7 @@ for (const htmlFile of allHtmls) {
|
|||
|
||||
const indexTemplate = await Bun.file("generators/index.html.template").text();
|
||||
const workTemplate = await Bun.file("generators/work.html.template").text();
|
||||
const readmeTemplate = await Bun.file("generators/README.md.template").text();
|
||||
|
||||
const allWorks = globSync("html/*.js")
|
||||
.map((file) => file.replace("html/", "").replace(".js", ""))
|
||||
|
@ -27,7 +28,16 @@ const index = indexTemplate.replace(
|
|||
"<!--/INSERT/-->",
|
||||
allWorks.map((work) => `<li><a href="/${work}">./${work}</a></li>`).join("\n")
|
||||
);
|
||||
|
||||
await Bun.write("html/index.html", index);
|
||||
|
||||
console.log(`index.html generated. ${allWorks.length} works found.`);
|
||||
const readme = readmeTemplate.replace(
|
||||
/<!--\/INSERT\/-->/,
|
||||
allWorks
|
||||
.map((work) => `- [./${work}](https://art.mekanoe.com/${work})`)
|
||||
.join("\n")
|
||||
);
|
||||
await Bun.write("README.md", readme);
|
||||
|
||||
console.log(
|
||||
`index.html & README.md generated. ${allWorks.length} works found.`
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue