Read the `name` field from a member directory's package.json.
(dirAbs: string)
| 1048 | |
| 1049 | /** Read the `name` field from a member directory's package.json. */ |
| 1050 | function readPackageName(dirAbs: string): string | null { |
| 1051 | try { |
| 1052 | const pkg = JSON.parse(fs.readFileSync(path.join(dirAbs, 'package.json'), 'utf-8')); |
| 1053 | return typeof pkg?.name === 'string' && pkg.name ? pkg.name : null; |
| 1054 | } catch { |
| 1055 | return null; |
| 1056 | } |
| 1057 | } |
no test coverage detected