UNPKG

chimp

Version:

Your development companion for doing quality, faster.

30 lines (29 loc) 954 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.setupListr = exports.newTask = void 0; const tslib_1 = require("tslib"); const debug_1 = tslib_1.__importDefault(require("debug")); const listr2_1 = require("listr2"); const debug = (0, debug_1.default)('Listr'); const newTask = (title, taskFunction) => ({ title, task: async (ctx, task) => taskFunction(task).catch((error) => { debug('%O', error); throw new Error(`${title}\n${error}\n`); }), options: { persistentOutput: true, }, }); exports.newTask = newTask; const spinner = new listr2_1.Spinner(); // @ts-ignore spinner.spinner = ['🙈 ', '🙈 ', '🙉 ', '🙉 ', '🙊 ', '🙊 ']; const setupListr = (tasks) => new listr2_1.Listr(tasks, { renderer: listr2_1.DefaultRenderer, rendererOptions: { spinner, }, fallbackRendererCondition: () => debug.enabled, }); exports.setupListr = setupListr;