read-local-package.js 329 B

123456789101112
  1. exports = module.exports = readLocalPkg
  2. var npm = require('../npm.js')
  3. var readJson = require('read-package-json')
  4. function readLocalPkg (cb) {
  5. if (npm.config.get('global')) return cb()
  6. var path = require('path')
  7. readJson(path.resolve(npm.prefix, 'package.json'), function (er, d) {
  8. return cb(er, d && d.name)
  9. })
  10. }