npmd-tree

3.3.4 • Public • Published

npmd-tree

query/traverse the node_modules tree

travis

example

#show the tree, as json.
 
npmd-tree
 
# compile binary deps.
 
npmd-tree -'if ( test -e binding.gyp) then node-gyp rebuild; fi' --quiet

or from javascript

var tree = require('npmd-tree').tree
var spawn = require('child_process)'.spawn
tree(process.cwd(), {post: function (pkg, cb) {
  //optionally, perform an async step, such as build the repo.
  if(!pkg.gypfile) return cb(null, pkg)
 
  var cp = spawn('node-gyp', ['rebuild'], {cwd: pkg.path})
  cp.stdout.pipe(process.stdout)
  cp.stderr.pipe(process.stderr)
  cp.on('exit', next)
  cp.on('error', next)
  var ended = false
  function next (err) {
    if(ended) return
    ended = true
    cb(err)
  }
}, function (err, tree) {
  if(err) throw err
  console.log(tree)
})
 

License

MIT

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 3.3.4
    2
    • latest

Version History

Package Sidebar

Install

npm i npmd-tree

Weekly Downloads

4

Version

3.3.4

License

MIT

Last publish

Collaborators

  • nopersonsmodules