MCPcopy Create free account
hub / github.com/Effect-TS/effect / findPackageRoot

Function findPackageRoot

packages/tools/jsdocs/src/Jsdocs.ts:548–561  ·  view source on GitHub ↗
(filename: string)

Source from the content-addressed store, hash-verified

546}
547
548function 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
563function readPackageMetadata(root: string): Result<PackageMetadata, string> {
564 const normalizedRoot = path.resolve(root)

Callers 1

resolveJSDocImportsFunction · 0.85

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected