Cortex Deps Traveller - Travel Package Dep Tree
Traveling cortex packages through dependencies tree.
Install
$ npm install cortex-deps-traveller --save
Usage
var traveller = built_root maxDepth: 3; traveller; // Advanced Usage, visit will travel the dep tree with BFS (which is better for performance)traveller; var Traveller = Traveller;
APIs
new Traveller(built_root, [options])
Options
- max_depth number
- dev boolean
- async boolean
- pkgDeps function
traveller.toJSONTree(pkg, callback)
Generate dependencies tree from pkg
traveller.visit(pkg, visitor, done)
Visit the dependencies tree of pkg with a visitor
- pkg {Object} pkg info object
- visitor {Visitor} visitor
- done {function} called when all the nodes are visited
traveller.topsort(tree, [rootName])
Return a sorted array from the tree
traveller;
- tree {Object} dependencies tree
- rootName {string=} the name of root package in the tree, used for output and cycle-detection
traveller.resolvePackage(name, range|version, callback)
Read package information object from name and range, which utilized the internal cache in traveller
traveller;
traveller.resolveRange(name, range, callback)
Return a version resolved from range for package
traveller;
traveller.readVersions(name, callback)
Return an array of available versions.
traveller;
- name {string} package name
- callback {function}
module.exports.topsort(root, [name])
Licence
MIT