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

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/cli/npm-outdated.md1
-rw-r--r--lib/outdated.js15
-rw-r--r--test/tap/outdated-long.js4
3 files changed, 16 insertions, 4 deletions
diff --git a/doc/cli/npm-outdated.md b/doc/cli/npm-outdated.md
index ad0d003ce..045586a40 100644
--- a/doc/cli/npm-outdated.md
+++ b/doc/cli/npm-outdated.md
@@ -27,6 +27,7 @@ In the output:
* `package type` (when using `--long` / `-l`) tells you whether this package is
a `dependency` or a `devDependency`. Packages not included in `package.json`
are always marked `dependencies`.
+* `homepage` (when using `--long` / `-l`) is the `homepage` value contained in the package's `package.json`
* Red means there's a newer version matching your semver requirements, so you should update now.
* Yellow indicates that there's a newer version above your semver requirements (usually new major, or new 0.x minor) so proceed with caution.
diff --git a/lib/outdated.js b/lib/outdated.js
index 8b0a43d6b..024e076c4 100644
--- a/lib/outdated.js
+++ b/lib/outdated.js
@@ -94,7 +94,7 @@ function outdated (args, silent, cb) {
'Latest',
'Location'
]
- if (long) outHead.push('Package Type')
+ if (long) outHead.push('Package Type', 'Homepage')
var outTable = [outHead].concat(outList)
if (npm.color) {
@@ -123,6 +123,7 @@ function makePretty (p) {
var latest = p[4]
var type = p[6]
var deppath = p[7]
+ var homepage = p[0].package.homepage
var columns = [ depname,
has || 'MISSING',
@@ -130,7 +131,10 @@ function makePretty (p) {
latest,
deppath
]
- if (long) columns[5] = type
+ if (long) {
+ columns[5] = type
+ columns[6] = homepage
+ }
if (npm.color) {
columns[0] = color[has === want || want === 'linked' ? 'yellow' : 'red'](columns[0]) // dep
@@ -157,7 +161,7 @@ function makeParseable (list) {
(has ? (depname + '@' + has) : 'MISSING'),
depname + '@' + latest
]
- if (long) out.push(type)
+ if (long) out.push(type, dep.package.homepage)
return out.join(':')
}).join(os.EOL)
@@ -181,7 +185,10 @@ function makeJSON (list) {
latest: latest,
location: dir
}
- if (long) out[depname].type = type
+ if (long) {
+ out[depname].type = type
+ out[depname].homepage = dep.package.homepage
+ }
})
return JSON.stringify(out, null, 2)
}
diff --git a/test/tap/outdated-long.js b/test/tap/outdated-long.js
index 6ea5e6e2c..976d416a1 100644
--- a/test/tap/outdated-long.js
+++ b/test/tap/outdated-long.js
@@ -74,6 +74,10 @@ test('it should not throw', function (t) {
npm.install('.', function (err) {
t.ifError(err, 'install success')
npm.config.set('long', true)
+ // since it's possible for the homepage of a package to change, after the
+ // install we read the value from the package.json directly to specify our
+ // expected output.
+ expOut[1] = expOut[1] + ':' + JSON.parse(fs.readFileSync(path.resolve(pkg, 'node_modules', 'underscore', 'package.json'))).homepage
npm.outdated(function (er, d) {
t.ifError(err, 'npm outdated ran without error')
t.is(process.exitCode, 1, 'exit code set to 1')