From 79fd6e0b437effea471e1c98b3b4524ccdd6b866 Mon Sep 17 00:00:00 2001 From: Ruy Adorno Date: Thu, 23 Jul 2020 11:31:10 -0400 Subject: fix: more dedupe edge cases PR-URL: https://github.com/npm/cli/pull/1545 Credit: @ruyadorno Close: #1545 Reviewed-by: @isaacs --- lib/ls.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'lib/ls.js') diff --git a/lib/ls.js b/lib/ls.js index d8f0554ad..2c6171b3c 100644 --- a/lib/ls.js +++ b/lib/ls.js @@ -115,27 +115,27 @@ const getHumanOutputItem = (node, { args, color, global, long }) => { const missingColor = isOptional(node) ? chalk.yellow.bgBlack : chalk.red.bgBlack - const missingMsg = `UNMET ${isOptional(node) ? 'OPTIONAL ' : ''}DEPENDENCY ` + const missingMsg = `UNMET ${isOptional(node) ? 'OPTIONAL ' : ''}DEPENDENCY` const label = ( node[_missing] - ? (color ? missingColor(missingMsg) : missingMsg) + ? (color ? missingColor(missingMsg) : missingMsg) + ' ' : '' ) + `${highlightDepName ? chalk.yellow.bgBlack(printable) : printable}` + ( node[_dedupe] - ? (color ? chalk.gray(' deduped') : ' deduped') + ? ' ' + (color ? chalk.gray('deduped') : 'deduped') : '' ) + ( node[_invalid] - ? (color ? chalk.red.bgBlack(' invalid') : ' invalid') + ? ' ' + (color ? chalk.red.bgBlack('invalid') : 'invalid') : '' ) + ( isExtraneous(node, { global }) - ? (color ? chalk.green.bgBlack(' extraneous') : ' extraneous') + ? ' ' + (color ? chalk.green.bgBlack('extraneous') : 'extraneous') : '' ) + (isGitNode(node) ? ` (${node.resolved})` : '') + @@ -263,6 +263,9 @@ const augmentNodesWithMetadata = ({ pkgid: node.pkgid, package: node.package, path: node.path, + isLink: node.isLink, + realpath: node.realpath, + [_invalid]: node[_invalid], [_missing]: node[_missing], [_dedupe]: true } -- cgit v1.2.3