1.1.1 • Published 7 years ago
read-pkgs v1.1.1
read-pkgs
Read
package.jsonin directories that match a glob pattern.
Glob a bunch of directories and then run them through read-pkg.
Install
$ yarn add read-pkgsUsage
const readPkgs = require('read-pkgs');
readPkgs('packages/*').then(pkgs => {
console.log(pkgs);
// [{directory: packages/packageOne, pkg: PACKAGEDATA}, {directory: packages/packageTwo, pkg: PACKAGEDATA}]
});API
readPkgs(patterns, options?)
Returns a Promise resolving to an array of loaded package.json with their given directory.
patterns
- Type:
stringArray<string>
A glob pattern or array of glob patterns matching directories that contain a package.json.
options
cwd
- Type:
string - Default:
process.cwd()
The current working directory in which to search.
normalize
- Type:
boolean - Default:
true
Whether or not to normalize the package data.
License
MIT © Matthew Fernando Garcia