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

Function parseNxWorkspace

packages/next-codemod/lib/agents-md.ts:484–500  ·  view source on GitHub ↗
(cwd: string, packageJsonPath: string)

Source from the content-addressed store, hash-verified

482}
483
484function parseNxWorkspace(cwd: string, packageJsonPath: string): string[] {
485 if (fs.existsSync(packageJsonPath)) {
486 const packages = parsePackageJsonWorkspaces(packageJsonPath)
487 if (packages.length > 0) {
488 return packages
489 }
490 }
491 const defaultPatterns = ['apps/*', 'libs/*', 'packages/*']
492 const existingPatterns: string[] = []
493 for (const pattern of defaultPatterns) {
494 const basePath = path.join(cwd, pattern.replace('/*', ''))
495 if (fs.existsSync(basePath)) {
496 existingPatterns.push(pattern)
497 }
498 }
499 return existingPatterns
500}
501
502function findNextjsInWorkspace(cwd: string, patterns: string[]): string | null {
503 const packagePaths = expandWorkspacePatterns(cwd, patterns)

Callers 1

detectWorkspaceFunction · 0.85

Calls 4

replaceMethod · 0.65
pushMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected