Generate a stdlib package tree.
var pkgTree = require( '@stdlib/tools/pkgs/tree' );Asynchronously generates a package tree.
pkgTree( onTree );
function onTree( error, tree ) {
if ( error ) {
throw error;
}
console.dir( tree );
}The function accepts the following options:
- dir: root directory from which to search for packages. May be either an absolute file path or a path relative to the
stdlib/lib/node_modules/directory. Default:/path/to/stdlib/lib/node_modules/.
To search from a descendant directory, set the dir option.
var opts = {
'dir': './@stdlib/math/base'
};
pkgTree( opts, onTree );
function onTree( error, tree ) {
if ( error ) {
throw error;
}
console.dir( tree );
}Synchronously generates a package tree.
var tree = pkgTree.sync();
// returns {...}The function accepts the same options as pkgTree() above.
- The function only returns packages under the
@stdlibscope.
var pkgTree = require( '@stdlib/tools/pkgs/tree' );
pkgTree( onTree );
function onTree( error, tree ) {
if ( error ) {
throw error;
}
console.dir( tree );
}Usage: stdlib-pkg-tree [options] [dir]
Options:
-h, --help Print this message.
-V, --version Print the package version.- If not provided a
dirargument, the search directory is the current working directory.
$ stdlib-pkg-tree