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