Read the `name` field from a member directory's package.json.
(dirAbs: string)
| 315 | |
| 316 | /** Read the `name` field from a member directory's package.json. */ |
| 317 | function 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 | } |
no test coverage detected