(module: string)
| 11 | } |
| 12 | |
| 13 | function loadVersion(module: string): string | null { |
| 14 | try { |
| 15 | const modulePath = path.dirname(require.resolve(`${module}/package.json`)); |
| 16 | const packageJsonPath = path.resolve(modulePath, 'package.json'); |
| 17 | const packageJson = JSON.parse(fs.readFileSync(packageJsonPath).toString()); |
| 18 | return packageJson.version ?? null; |
| 19 | } catch (_) { |
| 20 | return null; |
| 21 | } |
| 22 | } |
no test coverage detected