diff options
author | Joe Bottigliero <joe@bottigliero.com> | 2018-11-26 19:13:52 +0300 |
---|---|---|
committer | Kat Marchán <kzm@zkat.tech> | 2018-11-26 19:13:52 +0300 |
commit | 4be51a9cc65635bb26fa4ce62233f26e0104bc20 (patch) | |
tree | 772bd21e2d8684254df082a14028114a0cab0acd /lib/outdated.js | |
parent | 71d8fb4a94d65e1855f6d0c5f2ad2b7c3202e3c4 (diff) |
cli,outdated: Adds 'Homepage' to outdated --long output. (#81)
* feat(cli, outdated): Adds 'Homepage' to outdated --long output.
- `package.json`'s `homepage` property is displayed when using the `--long` option for `npm outdated`
* test: npm outdated --long
- Adds `homepage` to `--parseable` output.
- Updates `npm outdated --long` test to include `homepage` in expected output.
- Adds `homepage` to `npm-outdated` documentation.
* fix: javascript standard style updates
PR-URL: https://github.com/npm/cli/pull/81
Credit: @jbottigliero
Reviewed-By: @zkat
Diffstat (limited to 'lib/outdated.js')
-rw-r--r-- | lib/outdated.js | 15 |
1 files changed, 11 insertions, 4 deletions
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) } |