MCPcopy
hub / github.com/colbymchenry/codegraph / readPackageName

Function readPackageName

src/resolution/workspace-packages.ts:173–180  ·  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

171
172/** Read the `name` field from a member directory's package.json. */
173function readPackageName(dirAbs: string): string | null {
174 try {
175 const pkg = JSON.parse(fs.readFileSync(path.join(dirAbs, 'package.json'), 'utf-8'));
176 return typeof pkg?.name === 'string' && pkg.name ? pkg.name : null;
177 } catch {
178 return null;
179 }
180}

Callers 1

loadWorkspacePackagesFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected