root.js 320 B

123456789101112131415
  1. module.exports = root
  2. const npm = require('./npm.js')
  3. const output = require('./utils/output.js')
  4. root.usage = 'npm root [-g]'
  5. function root (args, silent, cb) {
  6. if (typeof cb !== 'function') {
  7. cb = silent
  8. silent = false
  9. }
  10. if (!silent) output(npm.dir)
  11. process.nextTick(cb.bind(this, null, npm.dir))
  12. }