(header: string, body?: string, footer?: string)
| 89 | } |
| 90 | |
| 91 | export function prettyWarning(header: string, body?: string, footer?: string) { |
| 92 | const prefix = "Warning: "; |
| 93 | const indent = Array(prefix.length).fill(" ").join(""); |
| 94 | const spacing = "\n\n"; |
| 95 | |
| 96 | const prettyPrefix = chalkWarning(prefix); |
| 97 | |
| 98 | const withIndents = (text?: string) => |
| 99 | text |
| 100 | ?.split("\n") |
| 101 | .map((line) => `${indent}${line}`) |
| 102 | .join("\n"); |
| 103 | |
| 104 | const prettyBody = withIndents(body); |
| 105 | const prettyFooter = withIndents(footer); |
| 106 | |
| 107 | log.warn( |
| 108 | `${prettyPrefix}${header}${prettyBody ? `${spacing}${prettyBody}` : ""}${ |
| 109 | prettyFooter ? `${spacing}${prettyFooter}` : "" |
| 110 | }` |
| 111 | ); |
| 112 | } |
no test coverage detected
searching dependent graphs…