Skip to content

0x-jerry/load-pkg

Repository files navigation

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
    }
  }
}

About

Detect the closest package.json recursively.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •