(node, { args, chalk, global, long })
| 279 | } |
| 280 | |
| 281 | const getHumanOutputItem = (node, { args, chalk, global, long }) => { |
| 282 | const { pkgid, path } = node |
| 283 | const workspacePkgId = chalk.blueBright(pkgid) |
| 284 | let printable = node.isWorkspace ? workspacePkgId : pkgid |
| 285 | |
| 286 | // special formatting for top-level package name |
| 287 | if (node.isRoot) { |
| 288 | const hasNoPackageJson = !Object.keys(node.package).length |
| 289 | if (hasNoPackageJson || global) { |
| 290 | printable = path |
| 291 | } else { |
| 292 | printable += `${long ? '\n' : ' '}${path}` |
| 293 | } |
| 294 | } |
| 295 | |
| 296 | // TODO there is a LOT of overlap with lib/utils/explain-dep.js here |
| 297 | |
| 298 | const highlightDepName = args.length && node[_filteredBy] |
| 299 | const missingColor = isOptional(node) |
| 300 | ? chalk.yellow |
| 301 | : chalk.red |
| 302 | const missingMsg = `UNMET ${isOptional(node) ? 'OPTIONAL ' : ''}DEPENDENCY` |
| 303 | const targetLocation = node.root |
| 304 | ? relative(node.root.realpath, node.realpath) |
| 305 | : node.targetLocation |
| 306 | const invalid = node[_invalid] |
| 307 | ? `invalid: ${node[_invalid]}` |
| 308 | : '' |
| 309 | const label = |
| 310 | ( |
| 311 | node[_missing] |
| 312 | ? missingColor(missingMsg) + ' ' |
| 313 | : '' |
| 314 | ) + |
| 315 | `${highlightDepName ? chalk.yellow(printable) : printable}` + |
| 316 | ( |
| 317 | node[_dedupe] |
| 318 | ? ' ' + chalk.dim('deduped') |
| 319 | : '' |
| 320 | ) + |
| 321 | ( |
| 322 | invalid |
| 323 | ? ' ' + chalk.red(invalid) |
| 324 | : '' |
| 325 | ) + |
| 326 | ( |
| 327 | isExtraneous(node, { global }) |
| 328 | ? ' ' + chalk.red('extraneous') |
| 329 | : '' |
| 330 | ) + |
| 331 | ( |
| 332 | node.overridden |
| 333 | ? ' ' + chalk.dim('overridden') |
| 334 | : '' |
| 335 | ) + |
| 336 | (isGitNode(node) ? ` (${node.resolved})` : '') + |
| 337 | (node.isLink ? ` -> ${relativePrefix}${targetLocation}` : '') + |
| 338 | (long ? `\n${node.package.description || ''}` : '') |
no test coverage detected