Skip to content

Commit eaa7c85

Browse files
fix: preserve static index.md during aggregation
The aggregate script was deleting the entire docs/repos/ dir including the committed index.md. Now saves and restores it.
1 parent b3fcb24 commit eaa7c85

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

scripts/aggregate.mjs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,26 @@ async function hasEntryPoint(dir) {
4141
return false;
4242
}
4343

44+
// Preserve static index.md (committed to repo, not generated)
45+
const staticIndex = path.join(OUT, "index.md");
46+
let savedIndex = null;
47+
try {
48+
savedIndex = await fs.readFile(staticIndex, "utf-8");
49+
} catch {
50+
// no static index to preserve
51+
}
52+
4453
// Clean previous outputs
4554
await fs.rm(TMP, { recursive: true, force: true });
4655
await fs.rm(OUT, { recursive: true, force: true });
4756
await fs.mkdir(TMP, { recursive: true });
4857
await fs.mkdir(OUT, { recursive: true });
4958

59+
// Restore static index.md
60+
if (savedIndex !== null) {
61+
await fs.writeFile(staticIndex, savedIndex);
62+
}
63+
5064
for (const r of repos) {
5165
console.log(`Aggregating: ${r.name}`);
5266

0 commit comments

Comments
 (0)