generate readme too
This commit is contained in:
parent
1da90f397b
commit
59a6487d99
4 changed files with 41 additions and 12 deletions
20
README.md
20
README.md
|
@ -1,15 +1,17 @@
|
|||
# noeidelon
|
||||
|
||||
To install dependencies:
|
||||
Foxes dream of electron beams.
|
||||
|
||||
```bash
|
||||
bun install
|
||||
```
|
||||
https://art.mekanoe.com
|
||||
|
||||
To run:
|
||||
## Development
|
||||
|
||||
```bash
|
||||
bun run .
|
||||
```
|
||||
`nix` to install bun... or do it globally.
|
||||
|
||||
This project was created using `bun init` in bun v1.0.3. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
|
||||
`bun run .` to generate HTMLs
|
||||
|
||||
`bun serve` to serve them locally
|
||||
|
||||
## Artworks
|
||||
|
||||
- [./001-platform-provenance](https://art.mekanoe.com/001-platform-provenance)
|
||||
|
|
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.`
|
||||
);
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
{
|
||||
"name": "noeidelon",
|
||||
"type": "module",
|
||||
"main": "./generators/generate.js",
|
||||
"scripts": {
|
||||
"start": "bun ./generators/generate.js",
|
||||
"serve": "serve ./html"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
Loading…
Add table
Reference in a new issue