mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-12 02:57:44 -04:00
fix(render-peer-issues): print a new line between summaries
This commit is contained in:
5
.changeset/lucky-singers-fetch.md
Normal file
5
.changeset/lucky-singers-fetch.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@pnpm/render-peer-issues": patch
|
||||
---
|
||||
|
||||
A new line should be between the summary about conflicting peers and non-conflicting ones.
|
||||
@@ -36,16 +36,20 @@ export default function (
|
||||
.filter(([, project]) => Object.keys(project.dependencies).length > 0)
|
||||
.sort(([projectKey1], [projectKey2]) => projectKey1.localeCompare(projectKey2))
|
||||
.map(([projectKey, project]) => {
|
||||
let summary = ''
|
||||
const summaries = []
|
||||
const { conflicts, intersections } = peerDependencyIssuesByProjects[projectKey]
|
||||
if (conflicts.length) {
|
||||
summary += chalk.red(`✕ Conflicting peer dependencies:\n ${cliColumns(conflicts, cliColumnsOptions)}`)
|
||||
summaries.push(
|
||||
chalk.red(`✕ Conflicting peer dependencies:\n ${cliColumns(conflicts, cliColumnsOptions)}`)
|
||||
)
|
||||
}
|
||||
if (Object.keys(intersections).length) {
|
||||
summary += `Peer dependencies that should be installed:\n ${cliColumns(Object.entries(intersections).map(([name, version]) => formatNameAndRange(name, version)), cliColumnsOptions)}`
|
||||
summaries.push(
|
||||
`Peer dependencies that should be installed:\n ${cliColumns(Object.entries(intersections).map(([name, version]) => formatNameAndRange(name, version)), cliColumnsOptions)}`
|
||||
)
|
||||
}
|
||||
const title = chalk.white(projectKey)
|
||||
return `${archy(toArchyData(title, project))}${summary}`
|
||||
return `${archy(toArchyData(title, project))}${summaries.join('\n')}`
|
||||
}).join('\n\n')
|
||||
}
|
||||
|
||||
|
||||
@@ -11,8 +11,13 @@ Peer dependencies that should be installed:
|
||||
aaa@^1.0.0
|
||||
|
||||
packages/0
|
||||
└─┬ zzz
|
||||
└── ✕ missing peer ddd@^1.0.0
|
||||
├─┬ zzz
|
||||
│ ├── ✕ missing peer ddd@^1.0.0
|
||||
│ └── ✕ missing peer eee@^1.0.0
|
||||
└─┬ www
|
||||
└── ✕ missing peer eee@^2.0.0
|
||||
✕ Conflicting peer dependencies:
|
||||
eee
|
||||
Peer dependencies that should be installed:
|
||||
ddd@^1.0.0 "
|
||||
`;
|
||||
|
||||
@@ -4,7 +4,7 @@ import stripAnsi from 'strip-ansi'
|
||||
test('renderPeerIssues()', () => {
|
||||
expect(stripAnsi(renderPeerIssues({
|
||||
'packages/0': {
|
||||
conflicts: [],
|
||||
conflicts: ['eee'],
|
||||
intersections: { ddd: '^1.0.0' },
|
||||
bad: {},
|
||||
missing: {
|
||||
@@ -20,6 +20,28 @@ test('renderPeerIssues()', () => {
|
||||
wantedRange: '^1.0.0',
|
||||
},
|
||||
],
|
||||
eee: [
|
||||
{
|
||||
parents: [
|
||||
{
|
||||
name: 'zzz',
|
||||
version: '1.0.0',
|
||||
},
|
||||
],
|
||||
optional: false,
|
||||
wantedRange: '^1.0.0',
|
||||
},
|
||||
{
|
||||
parents: [
|
||||
{
|
||||
name: 'www',
|
||||
version: '1.0.0',
|
||||
},
|
||||
],
|
||||
optional: false,
|
||||
wantedRange: '^2.0.0',
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
'.': {
|
||||
|
||||
Reference in New Issue
Block a user