MCPcopy
hub / github.com/vercel/next.js / walkRecursive

Function walkRecursive

packages/next-codemod/lib/agents-md.ts:585–603  ·  view source on GitHub ↗
(dir: string, results: string[])

Source from the content-addressed store, hash-verified

583}
584
585function 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
605function isDirectory(dirPath: string): boolean {
606 try {

Callers 1

walkFunction · 0.85

Calls 4

startsWithMethod · 0.80
isDirectoryFunction · 0.70
pushMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected