This repository has been archived by the owner. It is now read-only.

Discover newer versions of dependencies than package.json allows #1638

Closed
wants to merge 4 commits into
base: master
from
Prev

Added the CANUPDATE message, in case the remote version of the packag…

…e is ok with the packages.json
  • Loading branch information...
lazywithclass committed Nov 1, 2011
commit 0df03af4142605f62f74664172a82c4d8d84131b
View
@@ -50,10 +50,14 @@ function makePretty (p) {
, dir = path.resolve(p[0], "node_modules", dep)
, has = p[2]
, want = p[3]
, newerVersion = p[4]
, newer = p[4]
var depStatus = has ? (dep + "@" + has) : "MISSING"
if (newerVersion) {
depStatus = "OUTDATED("+newerVersion+" available)"
if (newer) {
if (semver.lte(newer, want)) {
depStatus = "CANUPDATE("+newer+" available)"
} else {
depStatus = "OUTDATED("+newer+" available)"
}
}
if (parseable) {
var str = dir
@@ -113,15 +117,12 @@ function outdated_ (args, dir, parentHas, cb) {
var depName = Object.keys(dep)[0]
get(depName, function (er, doc) {
var versions = Object.keys(doc.versions)
//TODO check if doc.version is lways ordered
var newest = versions[versions.length-1]
cb_(null, {"name": depName, "current": dep[depName], "newest": newest})
})
}, function (er, results) {
results.forEach(function (dep) {
if (semver.gt(dep.newest, dep.current)) {
//TODO why pass dep.current two times? is it correct?
//TODO why the double square parens?
if (semver.gte(dep.newest, dep.current)) {
cb(null, [[dir, dep.name, dep.current, dep.current, dep.newest]])
}
})
ProTip! Use n and p to navigate between commits in a pull request.