get-latest-npm-version.js 444 B

1234567891011121314
  1. var log = require('npmlog')
  2. var fetchPackageMetadata = require('../fetch-package-metadata')
  3. function getLatestNpmVersion (cb) {
  4. var tracker = log.newItem('getLatestNpmVersion', 1)
  5. tracker.info('getLatestNpmVersion', 'Getting npm package information')
  6. fetchPackageMetadata('npm@latest', '.', {}, function (err, d) {
  7. tracker.finish()
  8. if (err) { return cb(err) }
  9. cb(null, d.version)
  10. })
  11. }
  12. module.exports = getLatestNpmVersion