(expl, chalk, depth)
| 5 | // Depth is how far we want to want to descend into the object making a report. |
| 6 | // The full report (ie, depth=Infinity) is always written to the cache folder at ${cache}/eresolve-report.txt along with full json. |
| 7 | const explain = (expl, chalk, depth) => { |
| 8 | const { edge, dep, current, peerConflict, currentEdge } = expl |
| 9 | |
| 10 | const out = [] |
| 11 | const whileInstalling = dep && dep.whileInstalling || |
| 12 | current && current.whileInstalling || |
| 13 | edge && edge.from && edge.from.whileInstalling |
| 14 | if (whileInstalling) { |
| 15 | out.push('While resolving: ' + printNode(whileInstalling, chalk)) |
| 16 | } |
| 17 | |
| 18 | // it "should" be impossible for an ERESOLVE explanation to lack both current and currentEdge, but better to have a less helpful error than a crashing failure. |
| 19 | if (current) { |
| 20 | out.push('Found: ' + explainNode(current, depth, chalk)) |
| 21 | } else if (peerConflict && peerConflict.current) { |
| 22 | out.push('Found: ' + explainNode(peerConflict.current, depth, chalk)) |
| 23 | } else if (currentEdge) { |
| 24 | out.push('Found: ' + explainEdge(currentEdge, depth, chalk)) |
| 25 | } else /* istanbul ignore else - should always have one */ if (edge) { |
| 26 | out.push('Found: ' + explainEdge(edge, depth, chalk)) |
| 27 | } |
| 28 | |
| 29 | out.push('\nCould not resolve dependency:\n' + |
| 30 | explainEdge(edge, depth, chalk)) |
| 31 | |
| 32 | if (peerConflict) { |
| 33 | const heading = '\nConflicting peer dependency:' |
| 34 | const pc = explainNode(peerConflict.peer, depth, chalk) |
| 35 | out.push(heading + ' ' + pc) |
| 36 | } |
| 37 | |
| 38 | return out.join('\n') |
| 39 | } |
| 40 | |
| 41 | // generate a full verbose report and tell the user how to fix it |
| 42 | const report = (expl, chalk, noColorChalk) => { |
no test coverage detected
searching dependent graphs…