MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / readPackageName

Function readPackageName

src/resolution/workspace-packages.ts:317–324  ·  view source on GitHub ↗

Read the `name` field from a member directory's package.json.

(dirAbs: string)

Source from the content-addressed store, hash-verified

315
316/** Read the `name` field from a member directory's package.json. */
317function readPackageName(dirAbs: string): string | null {
318 try {
319 const pkg = JSON.parse(fs.readFileSync(path.join(dirAbs, 'package.json'), 'utf-8'));
320 return typeof pkg?.name === 'string' && pkg.name ? pkg.name : null;
321 } catch {
322 return null;
323 }
324}

Callers 1

loadWorkspacePackagesFunction · 0.85

Calls 1

joinMethod · 0.45

Tested by

no test coverage detected