UNPKG

s2s

Version:
38 lines (26 loc) 1.14 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.formatText = exports.trimAndFormatPath = void 0; var _path = _interopRequireDefault(require("path")); var _slash = _interopRequireDefault(require("slash")); var _chalk = _interopRequireDefault(require("chalk")); var _utils = require("../utils"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } const trimAndFormatPath = testPath => { const { basename, dirname } = (0, _utils.getDirAndBaseName)(testPath); return (0, _slash.default)(_chalk.default.dim(dirname + _path.default.sep) + _chalk.default.bold(basename)); }; exports.trimAndFormatPath = trimAndFormatPath; const formatText = (handlerType, inputPath, outputPath) => { const color = handlerType === 'TEMPLATE' ? 'cyan' : 'green'; const input = trimAndFormatPath(inputPath); const output = trimAndFormatPath((0, _utils.relativeFromCwd)(outputPath)); // $FlowFixMe const header = _chalk.default.reset.inverse.bold[color](handlerType); return `${header} ${input}${output}`; }; exports.formatText = formatText;