diff options
Diffstat (limited to 'deps/npm/lib/outdated.js')
-rw-r--r-- | deps/npm/lib/outdated.js | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/deps/npm/lib/outdated.js b/deps/npm/lib/outdated.js index 50bdb363d1c..dd597983650 100644 --- a/deps/npm/lib/outdated.js +++ b/deps/npm/lib/outdated.js @@ -40,6 +40,7 @@ var mapToRegistry = require('./utils/map-to-registry.js') var isExtraneous = require('./install/is-extraneous.js') var recalculateMetadata = require('./install/deps.js').recalculateMetadata var moduleName = require('./utils/module-name.js') +var output = require('./utils/output.js') function uniqName (item) { return item[0].path + '|' + item[1] + '|' + item[7] @@ -75,6 +76,7 @@ function outdated (args, silent, cb) { if (npm.config.get('depth') === Infinity) npm.config.set('depth', 0) readPackageTree(dir, andRecalculateMetadata(function (er, tree) { + if (!tree) return cb(er) mutateIntoLogicalTree(tree) outdated_(args, '', tree, {}, 0, function (er, list) { list = uniq(list || []).sort(function (aa, bb) { @@ -82,11 +84,10 @@ function outdated (args, silent, cb) { aa[1].localeCompare(bb[1]) }) if (er || silent || list.length === 0) return cb(er, list) - log.disableProgress() if (npm.config.get('json')) { - console.log(makeJSON(list)) + output(makeJSON(list)) } else if (npm.config.get('parseable')) { - console.log(makeParseable(list)) + output(makeParseable(list)) } else { var outList = list.map(makePretty) var outHead = [ 'Package', @@ -108,7 +109,7 @@ function outdated (args, silent, cb) { align: ['l', 'r', 'r', 'r', 'l'], stringLength: function (s) { return ansiTrim(s).length } } - console.log(table(outTable, tableOpts)) + output(table(outTable, tableOpts)) } cb(null, list.map(function (item) { return [item[0].parent.path].concat(item.slice(1, 7)) })) }) @@ -142,8 +143,6 @@ function makePretty (p) { columns[0] = color[has === want || want === 'linked' ? 'yellow' : 'red'](columns[0]) // dep columns[2] = color.green(columns[2]) // want columns[3] = color.magenta(columns[3]) // latest - columns[4] = color.brightBlack(columns[4]) // dir - if (long) columns[5] = color.brightBlack(columns[5]) // type } return columns @@ -333,7 +332,7 @@ function shouldUpdate (args, tree, dep, has, req, depth, pkgpath, cb, type) { if (args.length && args.indexOf(dep) === -1) return skip() var parsed = npa(dep + '@' + req) - if (tree.isLink && (tree.parent !== null && tree.parent.parent === null)) { + if (tree.isLink && tree.parent && tree.parent.isTop) { return doIt('linked', 'linked') } if (parsed.type === 'git' || parsed.type === 'hosted') { |