UNPKG

run-in-all

Version:

A CLI tool to run the same npm-script in multiple directories in parallel or sequential.

29 lines 896 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Logger = void 0; const chalk_1 = require("chalk"); class Logger { log(data, context) { this.printMessage(data, 'log', context); } error(data, context) { this.printMessage(data, 'error', context); } printMessage(data, level, context) { const contextMessage = context ? chalk_1.blue(`[${context}] `) : ''; for (let line of this.splitAndCleanLog(data)) { level == 'error' && (line = chalk_1.red(line)); console[level](`${contextMessage}${line}`); } } splitAndCleanLog(data) { return data .split('\n') .map((line) => line.trim()) .filter((line) => !!line); } } exports.Logger = Logger; const logger = new Logger(); exports.default = logger; //# sourceMappingURL=logger.js.map