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

Function parsePackageJsonWorkspaces

packages/next-codemod/lib/agents-md.ts:455–469  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

453}
454
455function parsePackageJsonWorkspaces(filePath: string): string[] {
456 try {
457 const content = fs.readFileSync(filePath, 'utf-8')
458 const pkg = JSON.parse(content)
459 if (Array.isArray(pkg.workspaces)) {
460 return pkg.workspaces
461 }
462 if (pkg.workspaces?.packages && Array.isArray(pkg.workspaces.packages)) {
463 return pkg.workspaces.packages
464 }
465 return []
466 } catch {
467 return []
468 }
469}
470
471function parseLernaConfig(filePath: string): string[] {
472 try {

Callers 2

detectWorkspaceFunction · 0.85
parseNxWorkspaceFunction · 0.85

Calls 3

readFileSyncMethod · 0.80
isArrayMethod · 0.80
parseMethod · 0.45

Tested by

no test coverage detected