(filename: string)
| 560 | } |
| 561 | |
| 562 | function findPackageRoot(filename: string): string | undefined { |
| 563 | let directory = path.dirname(path.resolve(filename)) |
| 564 | while (true) { |
| 565 | const packageJsonPath = path.join(directory, "package.json") |
| 566 | if (fs.existsSync(packageJsonPath)) { |
| 567 | return directory |
| 568 | } |
| 569 | const parent = path.dirname(directory) |
| 570 | if (parent === directory) { |
| 571 | return undefined |
| 572 | } |
| 573 | directory = parent |
| 574 | } |
| 575 | } |
| 576 | |
| 577 | function readPackageMetadata(root: string): Result<PackageMetadata, string> { |
| 578 | const normalizedRoot = path.resolve(root) |
no test coverage detected