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

Function findPackageRoot

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

Source from the content-addressed store, hash-verified

560}
561
562function 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
577function readPackageMetadata(root: string): Result<PackageMetadata, string> {
578 const normalizedRoot = path.resolve(root)

Callers 1

resolveJSDocImportsFunction · 0.85

Calls 2

resolveMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected