Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Package Tree

Generate a stdlib package tree.

Usage

var pkgTree = require( '@stdlib/tools/pkgs/tree' );

pkgTree( [options,] clbk )

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 );
}

pkgTree.sync( [options] )

Synchronously generates a package tree.

var tree = pkgTree.sync();
// returns {...}

The function accepts the same options as pkgTree() above.

Notes

  • The function only returns packages under the @stdlib scope.

Examples

var pkgTree = require( '@stdlib/tools/pkgs/tree' );

pkgTree( onTree );

function onTree( error, tree ) {
    if ( error ) {
        throw error;
    }
    console.dir( tree );
}

CLI

Usage

Usage: stdlib-pkg-tree [options] [dir]

Options:

  -h,    --help                Print this message.
  -V,    --version             Print the package version.

Notes

  • If not provided a dir argument, the search directory is the current working directory.

Examples

$ stdlib-pkg-tree