UNPKG

@mx-design/config-eslint9

Version:
25 lines (22 loc) 781 B
import { spinner } from '@clack/prompts'; import '../utils/execPromise.mjs'; import { print } from '../utils/print.mjs'; const s = spinner(); async function setCommands(commands = []) { for (let i = 0; i < commands.length; i++) { const command = commands[i]; s.start(command.text); await command.fn().then(() => { s.stop(command.label ? `\u2705 ${print.success(command.label, true)} ${command.successText}` : command.successText); }).catch((error) => { s.stop(command.label ? `\u274C ${print.error(command.label, true)} ${command.failText}` : command.failText); if (error) { print.error(` error.message: ${error.message} error.stack: ${error.stack} `); } }); } } export { setCommands };