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