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

Function expandWorkspacePatterns

packages/next-codemod/lib/agents-md.ts:523–540  ·  view source on GitHub ↗
(cwd: string, patterns: string[])

Source from the content-addressed store, hash-verified

521}
522
523function expandWorkspacePatterns(cwd: string, patterns: string[]): string[] {
524 const packagePaths: string[] = []
525
526 for (const pattern of patterns) {
527 if (pattern.startsWith('!')) continue
528
529 if (pattern.includes('*')) {
530 packagePaths.push(...expandGlobPattern(cwd, pattern))
531 } else {
532 const fullPath = path.join(cwd, pattern)
533 if (fs.existsSync(fullPath)) {
534 packagePaths.push(fullPath)
535 }
536 }
537 }
538
539 return [...new Set(packagePaths)]
540}
541
542function expandGlobPattern(cwd: string, pattern: string): string[] {
543 const parts = pattern.split('/')

Callers 1

findNextjsInWorkspaceFunction · 0.85

Calls 5

expandGlobPatternFunction · 0.85
startsWithMethod · 0.80
includesMethod · 0.80
pushMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected