MCPcopy Create free account
hub / github.com/npm/cli / printNode

Function printNode

lib/utils/explain-dep.js:20–35  ·  view source on GitHub ↗
(node, chalk)

Source from the content-addressed store, hash-verified

18}
19
20const printNode = (node, chalk) => {
21 const extra = []
22
23 for (const meta of ['extraneous', 'dev', 'optional', 'peer', 'bundled', 'overridden']) {
24 if (node[meta]) {
25 extra.push(` ${colorType(meta, chalk)}`)
26 }
27 }
28
29 const pkgid = node.isWorkspace
30 ? chalk.blueBright(`${node.name}@${node.version}`)
31 : `${node.name}@${node.version}`
32
33 return `${pkgid}${extra.join('')}` +
34 (node.location ? chalk.dim(`\n${node.location}`) : '')
35}
36
37const explainLinksIn = ({ linksIn }, depth, chalk, seen) => {
38 if (!linksIn || !linksIn.length || depth <= 0) {

Callers 4

explainNodeFunction · 0.85
explainFromFunction · 0.85
explainFunction · 0.85
explain-dep.jsFile · 0.85

Calls 2

colorTypeFunction · 0.85
pushMethod · 0.80

Tested by

no test coverage detected