UNPKG

firebase-ci

Version:

Simplified Firebase interaction for continuous integration including deploying hosting, functions, and database/storage rules.

66 lines (49 loc) 1.54 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.error = exports.warn = exports.success = exports.info = exports.log = void 0; var _chalk = _interopRequireDefault(require("chalk")); var _figures = _interopRequireDefault(require("figures")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const colorMapping = { warn: 'yellow', success: 'green', error: 'red' }; const iconMapping = { info: 'ℹ', warn: '⚠', success: '✔', error: '✖' }; const prefixMapping = { warn: 'Warning: ', error: 'Error: ' }; function colorLogger(type) { const color = colorMapping[type]; return text => { const chalkColor = _chalk.default[color]; return chalkColor ? chalkColor(text) : text; }; } function logType(type, message, other) { const icon = iconMapping[type]; const prefix = prefixMapping[type]; const colorLog = colorLogger(type); console.log(`${icon ? colorLog((0, _figures.default)(icon)) : ''} ${prefix ? colorLog(prefix) : ''}${message}`); if (other) { console.log('\n', other); } } const log = console.log; exports.log = log; const info = (message, other) => logType('info', message, other); exports.info = info; const success = (message, other) => logType('success', message, other); exports.success = success; const warn = (message, other) => logType('warn', message, other); exports.warn = warn; const error = (message, other) => logType('error', message, other); exports.error = error;