(dir: string, results: string[])
| 583 | } |
| 584 | |
| 585 | function walkRecursive(dir: string, results: string[]): void { |
| 586 | if (!fs.existsSync(dir)) return |
| 587 | |
| 588 | if (fs.existsSync(path.join(dir, 'package.json'))) { |
| 589 | results.push(dir) |
| 590 | } |
| 591 | |
| 592 | try { |
| 593 | for (const entry of fs.readdirSync(dir)) { |
| 594 | if (entry === 'node_modules' || entry.startsWith('.')) continue |
| 595 | const fullPath = path.join(dir, entry) |
| 596 | if (isDirectory(fullPath)) { |
| 597 | walkRecursive(fullPath, results) |
| 598 | } |
| 599 | } |
| 600 | } catch { |
| 601 | // Permission denied |
| 602 | } |
| 603 | } |
| 604 | |
| 605 | function isDirectory(dirPath: string): boolean { |
| 606 | try { |
no test coverage detected