const { join } = require("node:path"); const { lstatSync, readdirSync, writeFileSync } = require("node:fs"); // folders to not consider while crawling const EXCLUDE_DIR = new Set(["ws"]); const TEST_DIR = join(__dirname, "..", "tests"); const TEST_INDEX = join(TEST_DIR, "index.html"); const crawl = (path, tree = {}) => { for (const file of readdirSync(path)) { const current = join(path, file); if (current === TEST_INDEX) continue; if (lstatSync(current).isDirectory()) { if (EXCLUDE_DIR.has(file)) continue; const sub = {}; tree[file] = sub; crawl(current, sub); if (!Reflect.ownKeys(sub).length) { delete tree[file]; } } else if (file.endsWith(".html")) { const name = file === "index.html" ? "." : file.slice(0, -5); tree[name] = current.replace(TEST_DIR, ""); } } return tree; }; const createList = (tree) => { const ul = ["