0.1.0 • Published 9 years ago
gather-package-details v0.1.0
gather-package-details
Given the directory of a project utilizing npm and a list of file paths, collect package information pertaining to each path.
install
npm install gather-package-detailsusage
This module exports a single function, gatherPackageDetails(), which takes an options object. The following options can/must be specified:
projectRoot- required, path to the root of the project which is being investigatedmodulePaths- required, an array of paths to files that should be traced back to packageslicenseOverrides- an optional map of license names for specific packages. The keys of this object should be formatted asname@version, and the values can be any value
The method returns a promise for the details, { project, unresolved }
details.project- the root package, or project package, which is the parent to all of the discovered packages. SeePackagefor details about it's propertiesdetails.unresolved- an array of themodulePathsthat could not be matched to a package
examples
See the examples directory for usage:
Package
The Package class represents a node package, identified by a directory containing a package.json file. Each package has the following properties:
name- the name of the packageversion- the version, read from the package.json filedirectory- the directory where the package was foundlicenses- An array of license identifiers which this package advertises, or the values passed in via thelicenseOverridesoption.children- An array of sub-Packages that were found
other modules
This module is simply a wrapper around license-checker and read-package-tree, if you are looking for more low-level tools I suggest using those.