(packageJsonPath: string)
| 205 | } |
| 206 | |
| 207 | function parsePackageJson(packageJsonPath: string): Record<string, unknown> { |
| 208 | try { |
| 209 | const content = readFileSync(packageJsonPath, 'utf8'); |
| 210 | return JSON.parse(content); |
| 211 | } catch (error) { |
| 212 | throw new Error(`Failed to parse package.json at ${packageJsonPath}: ${(error as Error).message}`, { |
| 213 | cause: error |
| 214 | }); |
| 215 | } |
| 216 | } |
| 217 | |
| 218 | function getNpmPackageVariable(packageJson: Record<string, unknown>, variableName: string): string | undefined { |
| 219 | const prefix = '$npm_package_'; |
no outgoing calls
no test coverage detected