import fs from "node:fs"; import path from "node:path"; const repoRoot = process.cwd(); const legacyHtmlRoot = path.join(repoRoot, "archive-source"); function walkHtml(dir) { return fs.readdirSync(dir, { withFileTypes: true }).flatMap((entry) => { const fullPath = path.join(dir, entry.name); if (entry.isDirectory()) { return walkHtml(fullPath); } return entry.isFile() && entry.name.endsWith(".html") ? [fullPath] : []; }); } function removeWordPressResidue(html) { return html .replace(/\n?\s*/g, "\n") .replace( /\n?\s*