stackTrace(stack) { return cyan().underline(stack.trim()); }
const handle_error = ({error, message}) => { const cwd = process.cwd() + path.sep; if (message) { message = `${message}\n${grey().inverse(' INFO ')} ${error.message}`; } else { message = error.message; } // From nuxt-contrib/consola const lines = '\n' + error.stack .split('\n') .splice(1) .map(l => l .trim() .replace('file://', '') .replace(cwd, '') ) .map(line => ' ' + line .replace(/^at +/, m => grey(m)) .replace(/\((.+)\)/, (_, m) => `(${cyan(m)})`) ) .join('\n'); console.log(`\n\n${red().inverse(' ERROR ')} ${message}`); console.log(lines); process.exit(); }
function commandHelp() { console.log( [ kleur.underline('Usage'), '', ' ' + kleur.bold('styleguidist') + ' ' + kleur.cyan('<command>') + ' ' + kleur.yellow('[<options>]'), '', kleur.underline('Commands'), '', ' ' + kleur.cyan('build') + ' Build style guide', ' ' + kleur.cyan('server') + ' Run development server', ' ' + kleur.cyan('help') + ' Display React Styleguidist help', '', kleur.underline('Options'), '', ' ' + kleur.yellow('--config') + ' Config file path', ' ' + kleur.yellow('--open') + ' Open Styleguidist in the default browser', ' ' + kleur.yellow('--verbose') + ' Print debug information', ].join('\n') ); }
const cyan_bg = message => cyan().inverse(` ${message} `)