create-strapi-app
Version:
Generate a new Strapi application.
26 lines (22 loc) • 688 B
JavaScript
var chalk = require('chalk');
// TODO: move styles to API
const supportedStyles = {
magentaBright: chalk.magentaBright,
blueBright: chalk.blueBright,
yellowBright: chalk.yellowBright,
green: chalk.green,
red: chalk.red,
bold: chalk.bold,
italic: chalk.italic
};
function parseToChalk(template) {
let result = template;
for (const [color, chalkFunction] of Object.entries(supportedStyles)){
const regex = new RegExp(`{${color}}(.*?){/${color}}`, 'g');
result = result.replace(regex, (_, p1)=>chalkFunction(p1.trim()));
}
return result;
}
module.exports = parseToChalk;
//# sourceMappingURL=parse-to-chalk.js.map
;