| 48 | async function writeText(path, content) { await fsWriteFile(path, content); } |
| 49 | async function loadJSON(path) { return JSON.parse(await readText(path)); } |
| 50 | function listFilesRecursive(root) { |
| 51 | const results = []; |
| 52 | function walk(dir) { |
| 53 | let names; |
| 54 | try { names = readdirSync(dir).sort(); } catch { return; } |
| 55 | for (const name of names) { |
| 56 | const full = join(dir, name); |
| 57 | let st; |
| 58 | try { st = statSync(full); } catch { continue; } |
| 59 | if (st.isDirectory()) walk(full); else results.push(full); |
| 60 | } |
| 61 | } |
| 62 | walk(root); |
| 63 | return results; |
| 64 | } |
| 65 | |
| 66 | async function main() { |
| 67 | const args = parseArgs(process.argv); |