(filename: string)
| 546 | } |
| 547 | |
| 548 | function findPackageRoot(filename: string): string | undefined { |
| 549 | let directory = path.dirname(path.resolve(filename)) |
| 550 | while (true) { |
| 551 | const packageJsonPath = path.join(directory, "package.json") |
| 552 | if (fs.existsSync(packageJsonPath)) { |
| 553 | return directory |
| 554 | } |
| 555 | const parent = path.dirname(directory) |
| 556 | if (parent === directory) { |
| 557 | return undefined |
| 558 | } |
| 559 | directory = parent |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | function readPackageMetadata(root: string): Result<PackageMetadata, string> { |
| 564 | const normalizedRoot = path.resolve(root) |
no test coverage detected