Get all the NPM dependencies for a module / set of modules (goes down the stack, for all the subdependencies etc)
Get the dependency chain for a specified Node module (or a collection of modules). Think of it as a remote
getDepChain(package[s], options, callback), where:
npm lslike command, but without having the dependencies installed locally
/*** Get all dependencies for multiple versions of Express and NPM latest*/var getDepChain =util = ;;
using a filter function:
var getDepChain =util = ;;
Look in the /examples folder, there are more complex examples there.
I wanted to create my private NPM registry with custom replication, so I needed to know the dependency tree for a module in order to replicate it (along with all its subdependencies) to that private registry.
It goes to the NPM registry to get a module's dependencies (or even for more modules), then repeats the dependencies found and so on. It uses a cache (by default stored in __dirname + '/cache') so that if you get the info for a module it won't go to the registry a second time for the same module (but in case there is no compatible version found for the module based on the cached info, it will refresh the cache). For more info, checkout npm-pkginfo, which is used internally.