| 14 | } |
| 15 | |
| 16 | const walkRemove = (dir, match, removeNodeModules) => { |
| 17 | let entries |
| 18 | try { |
| 19 | entries = readdirSync(dir, { withFileTypes: true }) |
| 20 | } catch { |
| 21 | return |
| 22 | } |
| 23 | for (const entry of entries) { |
| 24 | const full = join(dir, entry.name) |
| 25 | if (match(entry.name)) { |
| 26 | rmSync(full, RM) |
| 27 | continue |
| 28 | } |
| 29 | if (entry.isDirectory()) { |
| 30 | if (PRUNE.has(entry.name) && !(removeNodeModules && entry.name === 'node_modules')) continue |
| 31 | walkRemove(full, match, removeNodeModules) |
| 32 | } |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | const cwd = process.cwd() |
| 37 | for (const arg of process.argv.slice(2)) { |