accelerator-tool
Version:
The Accelerator devtool. Generally invoked with accelerator-tool, npx accelerator-tool, or xlr8r.
24 lines (22 loc) • 555 B
JavaScript
import {
error,
log,
warn,
} from 'colorful-logging';
import {
npmLogWithColor,
} from './npmLogWithColor';
export function npmErrorWithColor(data) {
const stringified = String(data);
if (stringified.includes('ERR!')) {
error(stringified);
} else if (new RegExp(/^npm WARN../).test(stringified) &&
!stringified.includes('SKIPPING OPTIONAL DEPENDENCY'))
{
warn(stringified);
} else if (stringified.includes('notice')) {
log(stringified);
} else {
npmLogWithColor(stringified);
}
}