Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: explain command shows "bundled" flag for edge #2807

Merged
merged 1 commit into from Mar 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion lib/utils/explain-dep.js
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
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
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 > 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
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