Read the `name` field from a member directory's package.json.
(dirAbs: string)
| 1040 | |
| 1041 | /** Read the `name` field from a member directory's package.json. */ |
| 1042 | function readPackageName(dirAbs: string): string | null { |
| 1043 | try { |
| 1044 | const pkg = JSON.parse(fs.readFileSync(path.join(dirAbs, 'package.json'), 'utf-8')); |
| 1045 | return typeof pkg?.name === 'string' && pkg.name ? pkg.name : null; |
| 1046 | } catch { |
| 1047 | return null; |
| 1048 | } |
| 1049 | } |
no test coverage detected