Welcome to mirror list, hosted at ThFree Co, Russian Federation.

get-latest-npm-version.js « doctor « lib - github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 83b600396577531ee5ca5a4412aca2da007321cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
const log = require('npmlog')
const pacote = require('pacote')
const npm = require('../npm.js')

const getLatestNpmVersion = async cb => {
  const tracker = log.newItem('getLatestNpmVersion', 1)
  tracker.info('getLatestNpmVersion', 'Getting npm package information')
  let version = null
  let error = null
  try {
    version = (await pacote.manifest('npm@latest')).version
  } catch (er) {
    error = er
  }
  tracker.finish()
  return cb(error, version)
}

module.exports = getLatestNpmVersion