(expl, chalk, noColorChalk)
| 40 | |
| 41 | // generate a full verbose report and tell the user how to fix it |
| 42 | const report = (expl, chalk, noColorChalk) => { |
| 43 | const flags = [ |
| 44 | expl.strictPeerDeps ? '--no-strict-peer-deps' : '', |
| 45 | '--force', |
| 46 | '--legacy-peer-deps', |
| 47 | ].filter(Boolean) |
| 48 | |
| 49 | const or = (arr) => arr.length <= 2 |
| 50 | ? arr.join(' or ') : |
| 51 | arr.map((v, i, l) => i + 1 === l.length ? `or ${v}` : v).join(', ') |
| 52 | |
| 53 | const fix = `Fix the upstream dependency conflict, or retry this command with ${or(flags)} to accept an incorrect (and potentially broken) dependency resolution.` |
| 54 | |
| 55 | return { |
| 56 | explanation: `${explain(expl, chalk, 4)}\n\n${fix}`, |
| 57 | file: `# npm resolution error report\n\n${explain(expl, noColorChalk, Infinity)}\n\n${fix}`, |
| 58 | } |
| 59 | } |
| 60 | |
| 61 | module.exports = { |
| 62 | explain, |
no test coverage detected
searching dependent graphs…