Skip to content

Commit

Permalink
feat/explain: show when an edge is a bundled edge
Browse files Browse the repository at this point in the history
PR-URL: #2807
Credit: @kumavis
Close: #2807
Reviewed-by: @ruyadorno
  • Loading branch information
kumavis authored and ruyadorno committed Mar 4, 2021
1 parent 2d682e4 commit 3c9a589
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/utils/explain-dep.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,10 @@ const explainDependents = ({ name, dependents }, depth, color) => {
return str.split('\n').join('\n ')
}

const explainEdge = ({ name, type, from, spec }, depth, color) => {
const explainEdge = ({ name, type, bundled, from, spec }, depth, color) => {
const { bold } = color ? chalk : nocolor
return (type === 'prod' ? '' : `${colorType(type, color)} `) +
(bundled ? `${colorType('bundled', color)} ` : '') +
`${bold(name)}@"${bold(spec)}" from ` +
explainFrom(from, depth, color)
}
Expand Down
4 changes: 2 additions & 2 deletions tap-snapshots/test-lib-utils-explain-dep.js-TAP.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ manydep@1.0.0
exports[`test/lib/utils/explain-dep.js TAP bundled > explain color deep 1`] = `
bundle-of-joy@1.0.0 bundled
node_modules/bundle-of-joy
[1mprod-dep[22m@"[1m1.x[22m" from the root project
[34mbundled[39m [1mprod-dep[22m@"[1m1.x[22m" from the root project
`

exports[`test/lib/utils/explain-dep.js TAP bundled > explain nocolor shallow 1`] = `
bundle-of-joy@1.0.0 bundled
node_modules/bundle-of-joy
prod-dep@"1.x" from the root project
bundled prod-dep@"1.x" from the root project
`

exports[`test/lib/utils/explain-dep.js TAP bundled > print color 1`] = `
Expand Down
1 change: 1 addition & 0 deletions test/lib/utils/explain-dep.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ const cases = {
type: 'prod',
name: 'prod-dep',
spec: '1.x',
bundled: true,
from: {
location: '/path/to/project',
},
Expand Down

0 comments on commit 3c9a589

Please sign in to comment.