Move some READMEs to files and add transclude scripts

This commit is contained in:
2025-05-29 20:17:56 +02:00
parent 9742b8ac0e
commit f312705807
13 changed files with 170 additions and 111 deletions

21
TranscludeReadmes.js Normal file
View File

@@ -0,0 +1,21 @@
#!/usr/bin/env node
const fs = require('fs');
const dir = require('process').argv.slice(-1)[0];
const readme = `${dir}/README.md`;
if (fs.existsSync(readme)) {
let index;
for (const ext of ['js', 'html']) {
const path = `${dir}/index.${ext}`;
if (fs.existsSync(path)) {
index = path;
break;
}
}
if (index) {
fs.writeFileSync(
index,
fs.readFileSync(index, 'utf8').replaceAll(
'<!-- <README /> -->',
fs.readFileSync(readme, 'utf8').split('---').slice(1).join('---').trim()));
}
}