(header: string, body?: string, footer?: string)
| 66 | } |
| 67 | |
| 68 | export function prettyError(header: string, body?: string, footer?: string) { |
| 69 | const prefix = "Error: "; |
| 70 | const indent = Array(prefix.length).fill(" ").join(""); |
| 71 | const spacing = "\n\n"; |
| 72 | |
| 73 | const prettyPrefix = chalkError(prefix); |
| 74 | |
| 75 | const withIndents = (text?: string) => |
| 76 | text |
| 77 | ?.split("\n") |
| 78 | .map((line) => `${indent}${line}`) |
| 79 | .join("\n"); |
| 80 | |
| 81 | const prettyBody = withIndents(body); |
| 82 | const prettyFooter = withIndents(footer); |
| 83 | |
| 84 | log.error( |
| 85 | `${prettyPrefix}${header}${prettyBody ? `${spacing}${prettyBody}` : ""}${ |
| 86 | prettyFooter ? `${spacing}${prettyFooter}` : "" |
| 87 | }` |
| 88 | ); |
| 89 | } |
| 90 | |
| 91 | export function prettyWarning(header: string, body?: string, footer?: string) { |
| 92 | const prefix = "Warning: "; |
no test coverage detected
searching dependent graphs…