0.1.2 • Published 2 years ago

@0x-jerry/load-pkg v0.1.2

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Load Pkg

Detect the closest package.json recursively.

Example

const pkgFile = await loadPkg(path.join(__dirname, 'example/packages/pkg1'))
console.log(pkgFile)

output:

{
  "path": "<root-path>/example/packages/pkg1/package.json",
  "config": {}, // content of `package.json`
  "monorepo": false,
  "parent": {
    "path": "<root-path>/example/package.json",
    "config": {}, // content of `package.json`
    "monorepo": true,
    "parent": {
      "path": "<root-path>/package.json",
      "config": {}, // content of `package.json`
      "monorepo": false
    }
  }
}