diff options
author | Josh Clow <josh@textio.com> | 2017-09-03 08:39:51 +0300 |
---|---|---|
committer | Rebecca Turner <me@re-becca.org> | 2017-09-14 21:37:52 +0300 |
commit | 5bd0244eec347ce435e88ff12148c35da7c69efe (patch) | |
tree | 499bbe7efe160f967efc8476f7e6036b86527255 /lib | |
parent | cd8687e1257f59a253436d69e8d79a29c85d00c8 (diff) |
outdated: Use fetch-package-metadata, not cache.add
Use fetchPackageMetadata to get metadata for extracting version from
packages instead of cache.add (which in npm5 does not actually return
package metadata anymore)
PR-URL: https://github.com/npm/npm/pull/18385
Fixes: #16825
Credit: @joshclow
Reviewed-By: @iarna
Diffstat (limited to 'lib')
-rw-r--r-- | lib/outdated.js | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/outdated.js b/lib/outdated.js index f2fb2df79..a38137b66 100644 --- a/lib/outdated.js +++ b/lib/outdated.js @@ -32,7 +32,6 @@ var table = require('text-table') var semver = require('semver') var npa = require('npm-package-arg') var mutateIntoLogicalTree = require('./install/mutate-into-logical-tree.js') -var cache = require('./cache.js') var npm = require('./npm.js') var long = npm.config.get('long') var mapToRegistry = require('./utils/map-to-registry.js') @@ -42,6 +41,7 @@ var computeVersionSpec = require('./install/deps.js').computeVersionSpec var moduleName = require('./utils/module-name.js') var output = require('./utils/output.js') var ansiTrim = require('./utils/ansi-trim') +var fetchPackageMetadata = require('./fetch-package-metadata.js') function uniq (list) { // we maintain the array because we need an array, not iterator, return @@ -387,8 +387,12 @@ function shouldUpdate (args, tree, dep, has, req, depth, pkgpath, cb, type) { } } - // We didn't find the version in the doc. See if cache can find it. - cache.add(dep, req, null, false, onCacheAdd) + // We didn't find the version in the doc. See if we can find it in metadata. + var spec = dep + if (req) { + spec = dep + '@' + req + } + fetchPackageMetadata(spec, '', onCacheAdd) function onCacheAdd (er, d) { // if this fails, then it means we can't update this thing. |