Comparing version 2.0.2 to 2.0.3
@@ -0,1 +1,8 @@ | ||
## [2.0.3](https://github.com/cenk1cenk2/listr2/compare/v2.0.2...v2.0.3) (2020-05-19) | ||
### Bug Fixes | ||
* **deps:** exchange uuid with nanoid ([2048b3d](https://github.com/cenk1cenk2/listr2/commit/2048b3d953ab5cab0cf67ffe26fa24fb987e6b6e)), closes [#25](https://github.com/cenk1cenk2/listr2/issues/25) | ||
## [2.0.2](https://github.com/cenk1cenk2/listr2/compare/v2.0.1...v2.0.2) (2020-05-18) | ||
@@ -2,0 +9,0 @@ |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.stateConstants = void 0; | ||
var stateConstants; | ||
@@ -4,0 +5,0 @@ (function (stateConstants) { |
"use strict"; | ||
function __export(m) { | ||
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
}) : (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
o[k2] = m[k]; | ||
})); | ||
var __exportStar = (this && this.__exportStar) || function(m, exports) { | ||
for (var p in m) if (p !== "default" && !exports.hasOwnProperty(p)) __createBinding(exports, m, p); | ||
} | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
__export(require("./listr")); | ||
__export(require("./manager")); | ||
__export(require("./interfaces/listr.interface")); | ||
__export(require("./utils/logger")); | ||
__export(require("./utils/logger.constants")); | ||
__export(require("./utils/prompt")); | ||
__exportStar(require("./listr"), exports); | ||
__exportStar(require("./manager"), exports); | ||
__exportStar(require("./interfaces/listr.interface"), exports); | ||
__exportStar(require("./utils/logger"), exports); | ||
__exportStar(require("./utils/logger.constants"), exports); | ||
__exportStar(require("./utils/prompt.interface"), exports); | ||
__exportStar(require("./utils/prompt"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -92,2 +92,12 @@ /// <reference types="node" /> | ||
} | ||
export declare class ListrBaseRenderer implements ListrRenderer { | ||
static rendererOptions: Record<string, any>; | ||
static rendererTaskOptions: Record<string, any>; | ||
static nonTTY: boolean; | ||
tasks: ListrTaskObject<any, typeof ListrBaseRenderer>[]; | ||
options: typeof ListrBaseRenderer.rendererOptions; | ||
constructor(tasks: ListrTaskObject<any, typeof ListrBaseRenderer>[], options: typeof ListrBaseRenderer.rendererOptions); | ||
render(): void; | ||
end(err?: Error): void; | ||
} | ||
export interface ListrRendererFactory { | ||
@@ -94,0 +104,0 @@ rendererOptions: Record<string, any>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.PromptError = exports.ListrError = exports.ListrBaseRenderer = void 0; | ||
class ListrBaseRenderer { | ||
constructor(tasks, options) { | ||
this.tasks = tasks; | ||
this.options = options; | ||
} | ||
render() { } | ||
end(err) { } | ||
} | ||
exports.ListrBaseRenderer = ListrBaseRenderer; | ||
class ListrError extends Error { | ||
@@ -4,0 +14,0 @@ constructor(message, errors, context) { |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TaskWrapper = void 0; | ||
const through_1 = __importDefault(require("through")); | ||
@@ -8,0 +9,0 @@ const state_constants_1 = require("../constants/state.constants"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.TaskType = void 0; | ||
var TaskType; | ||
@@ -4,0 +5,0 @@ (function (TaskType) { |
@@ -6,6 +6,7 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Task = void 0; | ||
const stream_to_observable_1 = __importDefault(require("@samverschueren/stream-to-observable")); | ||
const nanoid_1 = require("nanoid"); | ||
const rxjs_1 = require("rxjs"); | ||
const stream_1 = require("stream"); | ||
const uuid_1 = require("uuid"); | ||
const state_constants_1 = require("../constants/state.constants"); | ||
@@ -23,3 +24,3 @@ const listr_interface_1 = require("../interfaces/listr.interface"); | ||
this.rendererOptions = rendererOptions; | ||
this.id = uuid_1.v4(); | ||
this.id = nanoid_1.nanoid(); | ||
this.title = (_a = this.tasks) === null || _a === void 0 ? void 0 : _a.title; | ||
@@ -26,0 +27,0 @@ this.task = this.tasks.task; |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Listr = void 0; | ||
const p_map_1 = __importDefault(require("p-map")); | ||
@@ -8,0 +9,0 @@ const state_constants_1 = require("./constants/state.constants"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Manager = void 0; | ||
const listr_1 = require("./listr"); | ||
@@ -4,0 +5,0 @@ class Manager { |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.DefaultRenderer = void 0; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
@@ -14,189 +15,192 @@ const cli_cursor_1 = __importDefault(require("cli-cursor")); | ||
const log_update_1 = __importDefault(require("log-update")); | ||
class DefaultRenderer { | ||
constructor(tasks, options) { | ||
this.tasks = tasks; | ||
this.options = options; | ||
this.bottomBar = {}; | ||
this.options = { ...DefaultRenderer.rendererOptions, ...this.options }; | ||
} | ||
getTaskOptions(task) { | ||
return { ...DefaultRenderer.rendererTaskOptions, ...task.rendererTaskOptions }; | ||
} | ||
isBottomBar(task) { | ||
const bottomBar = this.getTaskOptions(task).bottomBar; | ||
return typeof bottomBar === 'number' && bottomBar !== 0 || | ||
typeof bottomBar === 'boolean' && bottomBar !== false; | ||
} | ||
hasPersistentOutput(task) { | ||
return this.getTaskOptions(task).persistentOutput === true; | ||
} | ||
render() { | ||
if (this.id) { | ||
return; | ||
let DefaultRenderer = (() => { | ||
class DefaultRenderer { | ||
constructor(tasks, options) { | ||
this.tasks = tasks; | ||
this.options = options; | ||
this.bottomBar = {}; | ||
this.options = { ...DefaultRenderer.rendererOptions, ...this.options }; | ||
} | ||
cli_cursor_1.default.hide(); | ||
this.id = setInterval(() => { | ||
log_update_1.default(this.multiLineRenderer(this.tasks), this.renderBottomBar(), this.renderPrompt()); | ||
}, 100); | ||
} | ||
end() { | ||
if (this.id) { | ||
clearInterval(this.id); | ||
this.id = undefined; | ||
getTaskOptions(task) { | ||
return { ...DefaultRenderer.rendererTaskOptions, ...task.rendererTaskOptions }; | ||
} | ||
log_update_1.default(this.multiLineRenderer(this.tasks), this.renderBottomBar()); | ||
if (this.options.clearOutput) { | ||
log_update_1.default.clear(); | ||
isBottomBar(task) { | ||
const bottomBar = this.getTaskOptions(task).bottomBar; | ||
return typeof bottomBar === 'number' && bottomBar !== 0 || | ||
typeof bottomBar === 'boolean' && bottomBar !== false; | ||
} | ||
else { | ||
log_update_1.default.done(); | ||
hasPersistentOutput(task) { | ||
return this.getTaskOptions(task).persistentOutput === true; | ||
} | ||
cli_cursor_1.default.show(); | ||
} | ||
multiLineRenderer(tasks, level = 0) { | ||
let output = []; | ||
for (const task of tasks) { | ||
if (task.isEnabled()) { | ||
if (task.hasTitle()) { | ||
if (task.isSkipped() && this.options.collapseSkips) { | ||
task.title = !task.isSkipped() ? `${task === null || task === void 0 ? void 0 : task.title}` : `${task === null || task === void 0 ? void 0 : task.output} ${chalk_1.default.dim('[SKIPPED]')}`; | ||
render() { | ||
if (this.id) { | ||
return; | ||
} | ||
cli_cursor_1.default.hide(); | ||
this.id = setInterval(() => { | ||
log_update_1.default(this.multiLineRenderer(this.tasks), this.renderBottomBar(), this.renderPrompt()); | ||
}, 100); | ||
} | ||
end() { | ||
if (this.id) { | ||
clearInterval(this.id); | ||
this.id = undefined; | ||
} | ||
log_update_1.default(this.multiLineRenderer(this.tasks), this.renderBottomBar()); | ||
if (this.options.clearOutput) { | ||
log_update_1.default.clear(); | ||
} | ||
else { | ||
log_update_1.default.done(); | ||
} | ||
cli_cursor_1.default.show(); | ||
} | ||
multiLineRenderer(tasks, level = 0) { | ||
let output = []; | ||
for (const task of tasks) { | ||
if (task.isEnabled()) { | ||
if (task.hasTitle()) { | ||
if (task.isSkipped() && this.options.collapseSkips) { | ||
task.title = !task.isSkipped() ? `${task === null || task === void 0 ? void 0 : task.title}` : `${task === null || task === void 0 ? void 0 : task.output} ${chalk_1.default.dim('[SKIPPED]')}`; | ||
} | ||
if (!(tasks.some((task) => task.hasFailed()) && !task.hasFailed() && task.options.exitOnError !== false && !(task.isCompleted() || task.isSkipped()))) { | ||
output.push(this.formatString(task.title, this.getSymbol(task), level)); | ||
} | ||
else { | ||
output.push(this.formatString(task.title, chalk_1.default.red(figures_1.default.squareSmallFilled), level)); | ||
} | ||
} | ||
if (!(tasks.some((task) => task.hasFailed()) && !task.hasFailed() && task.options.exitOnError !== false && !(task.isCompleted() || task.isSkipped()))) { | ||
output.push(this.formatString(task.title, this.getSymbol(task), level)); | ||
} | ||
else { | ||
output.push(this.formatString(task.title, chalk_1.default.red(figures_1.default.squareSmallFilled), level)); | ||
} | ||
} | ||
if (task === null || task === void 0 ? void 0 : task.output) { | ||
if (task.isPending() && task.isPrompt()) { | ||
this.promptBar = task.output; | ||
} | ||
else if (this.isBottomBar(task) || !task.hasTitle()) { | ||
const data = this.dumpData(task, -1); | ||
if (!this.bottomBar[task.id]) { | ||
this.bottomBar[task.id] = {}; | ||
this.bottomBar[task.id].data = []; | ||
const bottomBar = this.getTaskOptions(task).bottomBar; | ||
if (typeof bottomBar === 'boolean') { | ||
this.bottomBar[task.id].items = 1; | ||
if (task === null || task === void 0 ? void 0 : task.output) { | ||
if (task.isPending() && task.isPrompt()) { | ||
this.promptBar = task.output; | ||
} | ||
else if (this.isBottomBar(task) || !task.hasTitle()) { | ||
const data = this.dumpData(task, -1); | ||
if (!this.bottomBar[task.id]) { | ||
this.bottomBar[task.id] = {}; | ||
this.bottomBar[task.id].data = []; | ||
const bottomBar = this.getTaskOptions(task).bottomBar; | ||
if (typeof bottomBar === 'boolean') { | ||
this.bottomBar[task.id].items = 1; | ||
} | ||
else { | ||
this.bottomBar[task.id].items = bottomBar; | ||
} | ||
} | ||
else { | ||
this.bottomBar[task.id].items = bottomBar; | ||
if (!(data === null || data === void 0 ? void 0 : data.some((element) => this.bottomBar[task.id].data.includes(element)))) { | ||
this.bottomBar[task.id].data = [...this.bottomBar[task.id].data, ...data]; | ||
} | ||
} | ||
if (!(data === null || data === void 0 ? void 0 : data.some((element) => this.bottomBar[task.id].data.includes(element)))) { | ||
this.bottomBar[task.id].data = [...this.bottomBar[task.id].data, ...data]; | ||
else if (task.isPending() || this.hasPersistentOutput(task)) { | ||
output = [...output, ...this.dumpData(task, level)]; | ||
} | ||
else if (task.isSkipped() && this.options.collapseSkips === false) { | ||
output = [...output, ...this.dumpData(task, level)]; | ||
} | ||
} | ||
else if (task.isPending() || this.hasPersistentOutput(task)) { | ||
output = [...output, ...this.dumpData(task, level)]; | ||
if ((task.isPending() || task.hasFailed() | ||
|| task.isCompleted() && !task.hasTitle() | ||
|| task.isCompleted() && this.options.collapse === false && task.hasSubtasks() && !task.subtasks.some((subtask) => subtask.rendererOptions.collapse === true) | ||
|| task.isCompleted() && task.hasSubtasks() && task.subtasks.some((subtask) => subtask.rendererOptions.collapse === false) | ||
|| task.isCompleted() && task.hasSubtasks() && task.subtasks.some((subtask) => subtask.hasFailed())) | ||
&& this.options.showSubtasks !== false && task.hasSubtasks()) { | ||
const subtaskLevel = !task.hasTitle() ? level : level + 1; | ||
const subtaskRender = this.multiLineRenderer(task.subtasks, subtaskLevel); | ||
if (subtaskRender !== '') { | ||
output = [...output, subtaskRender]; | ||
} | ||
} | ||
else if (task.isSkipped() && this.options.collapseSkips === false) { | ||
output = [...output, ...this.dumpData(task, level)]; | ||
if (task.isCompleted() || task.hasFailed()) { | ||
this.promptBar = null; | ||
if (task.hasFailed() || (!task.hasTitle() || this.isBottomBar(task)) && this.hasPersistentOutput(task) !== true) { | ||
delete this.bottomBar[task.id]; | ||
} | ||
} | ||
} | ||
if ((task.isPending() || task.hasFailed() | ||
|| task.isCompleted() && !task.hasTitle() | ||
|| task.isCompleted() && this.options.collapse === false && task.hasSubtasks() && !task.subtasks.some((subtask) => subtask.rendererOptions.collapse === true) | ||
|| task.isCompleted() && task.hasSubtasks() && task.subtasks.some((subtask) => subtask.rendererOptions.collapse === false) | ||
|| task.isCompleted() && task.hasSubtasks() && task.subtasks.some((subtask) => subtask.hasFailed())) | ||
&& this.options.showSubtasks !== false && task.hasSubtasks()) { | ||
const subtaskLevel = !task.hasTitle() ? level : level + 1; | ||
const subtaskRender = this.multiLineRenderer(task.subtasks, subtaskLevel); | ||
if (subtaskRender !== '') { | ||
output = [...output, subtaskRender]; | ||
} | ||
if (output.length > 0) { | ||
return output.join('\n'); | ||
} | ||
else { | ||
return; | ||
} | ||
} | ||
renderBottomBar() { | ||
if (Object.keys(this.bottomBar).length > 0) { | ||
this.bottomBar = Object.keys(this.bottomBar).reduce((o, key) => { | ||
if (!(o === null || o === void 0 ? void 0 : o[key])) { | ||
o[key] = {}; | ||
} | ||
} | ||
if (task.isCompleted() || task.hasFailed()) { | ||
this.promptBar = null; | ||
if (task.hasFailed() || (!task.hasTitle() || this.isBottomBar(task)) && this.hasPersistentOutput(task) !== true) { | ||
delete this.bottomBar[task.id]; | ||
} | ||
} | ||
o[key] = this.bottomBar[key]; | ||
this.bottomBar[key].data = this.bottomBar[key].data.slice(-this.bottomBar[key].items); | ||
o[key].data = this.bottomBar[key].data; | ||
return o; | ||
}, {}); | ||
const returnRender = Object.values(this.bottomBar).reduce((o, value) => o = [...o, ...value.data], []); | ||
return ['\n', ...returnRender].join('\n'); | ||
} | ||
} | ||
if (output.length > 0) { | ||
return output.join('\n'); | ||
renderPrompt() { | ||
if (this.promptBar) { | ||
return `\n\n${this.promptBar}`; | ||
} | ||
} | ||
else { | ||
return; | ||
dumpData(task, level) { | ||
const output = []; | ||
if (typeof task.output === 'string') { | ||
task.output.split('\n').filter(Boolean).forEach((line, i) => { | ||
const icon = i === 0 ? this.getSymbol(task, true) : ' '; | ||
output.push(this.formatString(line, icon, level + 1)); | ||
}); | ||
} | ||
return output; | ||
} | ||
} | ||
renderBottomBar() { | ||
if (Object.keys(this.bottomBar).length > 0) { | ||
this.bottomBar = Object.keys(this.bottomBar).reduce((o, key) => { | ||
if (!(o === null || o === void 0 ? void 0 : o[key])) { | ||
o[key] = {}; | ||
formatString(string, icon, level) { | ||
var _a; | ||
return `${cli_truncate_1.default(indent_string_1.default(`${icon} ${string}`, level * this.options.indentation), (_a = process.stdout.columns) !== null && _a !== void 0 ? _a : Infinity)}`; | ||
} | ||
getSymbol(task, data = false) { | ||
if (!task.spinner && !data) { | ||
task.spinner = elegant_spinner_1.default(); | ||
} | ||
if (task.isPending() && !data) { | ||
return this.options.showSubtasks !== false && task.hasSubtasks() ? chalk_1.default.yellow(figures_1.default.pointer) : chalk_1.default.yellowBright(task.spinner()); | ||
} | ||
if (task.isCompleted() && !data) { | ||
if (task.hasSubtasks() && task.subtasks.some((subtask) => subtask.hasFailed())) { | ||
return chalk_1.default.yellow(figures_1.default.warning); | ||
} | ||
o[key] = this.bottomBar[key]; | ||
this.bottomBar[key].data = this.bottomBar[key].data.slice(-this.bottomBar[key].items); | ||
o[key].data = this.bottomBar[key].data; | ||
return o; | ||
}, {}); | ||
const returnRender = Object.values(this.bottomBar).reduce((o, value) => o = [...o, ...value.data], []); | ||
return ['\n', ...returnRender].join('\n'); | ||
} | ||
} | ||
renderPrompt() { | ||
if (this.promptBar) { | ||
return `\n\n${this.promptBar}`; | ||
} | ||
} | ||
dumpData(task, level) { | ||
const output = []; | ||
if (typeof task.output === 'string') { | ||
task.output.split('\n').filter(Boolean).forEach((line, i) => { | ||
const icon = i === 0 ? this.getSymbol(task, true) : ' '; | ||
output.push(this.formatString(line, icon, level + 1)); | ||
}); | ||
} | ||
return output; | ||
} | ||
formatString(string, icon, level) { | ||
var _a; | ||
return `${cli_truncate_1.default(indent_string_1.default(`${icon} ${string}`, level * this.options.indentation), (_a = process.stdout.columns) !== null && _a !== void 0 ? _a : Infinity)}`; | ||
} | ||
getSymbol(task, data = false) { | ||
if (!task.spinner && !data) { | ||
task.spinner = elegant_spinner_1.default(); | ||
} | ||
if (task.isPending() && !data) { | ||
return this.options.showSubtasks !== false && task.hasSubtasks() ? chalk_1.default.yellow(figures_1.default.pointer) : chalk_1.default.yellowBright(task.spinner()); | ||
} | ||
if (task.isCompleted() && !data) { | ||
if (task.hasSubtasks() && task.subtasks.some((subtask) => subtask.hasFailed())) { | ||
return chalk_1.default.green(figures_1.default.tick); | ||
} | ||
if (task.hasFailed() && !data) { | ||
return task.hasSubtasks() ? chalk_1.default.red(figures_1.default.pointer) : chalk_1.default.red(figures_1.default.cross); | ||
} | ||
if (task.isSkipped() && !data && this.options.collapseSkips === false) { | ||
return chalk_1.default.yellow(figures_1.default.warning); | ||
} | ||
return chalk_1.default.green(figures_1.default.tick); | ||
else if (task.isSkipped() && (data || this.options.collapseSkips)) { | ||
return chalk_1.default.yellow(figures_1.default.arrowDown); | ||
} | ||
if (task.isPrompt()) { | ||
return chalk_1.default.cyan(figures_1.default.questionMarkPrefix); | ||
} | ||
if (!data) { | ||
return chalk_1.default.dim(figures_1.default.squareSmallFilled); | ||
} | ||
else { | ||
return figures_1.default.pointerSmall; | ||
} | ||
} | ||
if (task.hasFailed() && !data) { | ||
return task.hasSubtasks() ? chalk_1.default.red(figures_1.default.pointer) : chalk_1.default.red(figures_1.default.cross); | ||
} | ||
if (task.isSkipped() && !data && this.options.collapseSkips === false) { | ||
return chalk_1.default.yellow(figures_1.default.warning); | ||
} | ||
else if (task.isSkipped() && (data || this.options.collapseSkips)) { | ||
return chalk_1.default.yellow(figures_1.default.arrowDown); | ||
} | ||
if (task.isPrompt()) { | ||
return chalk_1.default.cyan(figures_1.default.questionMarkPrefix); | ||
} | ||
if (!data) { | ||
return chalk_1.default.dim(figures_1.default.squareSmallFilled); | ||
} | ||
else { | ||
return figures_1.default.pointerSmall; | ||
} | ||
} | ||
} | ||
DefaultRenderer.nonTTY = false; | ||
DefaultRenderer.rendererOptions = { | ||
indentation: 2, | ||
clearOutput: false, | ||
showSubtasks: true, | ||
collapse: true, | ||
collapseSkips: true | ||
}; | ||
return DefaultRenderer; | ||
})(); | ||
exports.DefaultRenderer = DefaultRenderer; | ||
DefaultRenderer.nonTTY = false; | ||
DefaultRenderer.rendererOptions = { | ||
indentation: 2, | ||
clearOutput: false, | ||
showSubtasks: true, | ||
collapse: true, | ||
collapseSkips: true | ||
}; | ||
//# sourceMappingURL=default.renderer.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
class SilentRenderer { | ||
constructor(tasks, options) { | ||
this.tasks = tasks; | ||
this.options = options; | ||
exports.SilentRenderer = void 0; | ||
let SilentRenderer = (() => { | ||
class SilentRenderer { | ||
constructor(tasks, options) { | ||
this.tasks = tasks; | ||
this.options = options; | ||
} | ||
render() { } | ||
end() { } | ||
} | ||
render() { } | ||
end() { } | ||
} | ||
SilentRenderer.nonTTY = true; | ||
return SilentRenderer; | ||
})(); | ||
exports.SilentRenderer = SilentRenderer; | ||
SilentRenderer.nonTTY = true; | ||
//# sourceMappingURL=silent.renderer.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VerboseRenderer = void 0; | ||
const logger_1 = require("../utils/logger"); | ||
class VerboseRenderer { | ||
constructor(tasks, options) { | ||
var _a, _b; | ||
this.tasks = tasks; | ||
this.options = options; | ||
if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.logger)) { | ||
this.logger = new logger_1.Logger({ useIcons: (_b = this.options) === null || _b === void 0 ? void 0 : _b.useIcons }); | ||
let VerboseRenderer = (() => { | ||
class VerboseRenderer { | ||
constructor(tasks, options) { | ||
var _a, _b; | ||
this.tasks = tasks; | ||
this.options = options; | ||
if (!((_a = this.options) === null || _a === void 0 ? void 0 : _a.logger)) { | ||
this.logger = new logger_1.Logger({ useIcons: (_b = this.options) === null || _b === void 0 ? void 0 : _b.useIcons }); | ||
} | ||
else { | ||
this.logger = new this.options.logger(); | ||
} | ||
} | ||
else { | ||
this.logger = new this.options.logger(); | ||
render() { | ||
this.verboseRenderer(this.tasks); | ||
} | ||
} | ||
render() { | ||
this.verboseRenderer(this.tasks); | ||
} | ||
end() { } | ||
verboseRenderer(tasks) { | ||
return tasks === null || tasks === void 0 ? void 0 : tasks.forEach((task) => { | ||
task.subscribe((event) => { | ||
if (task.isEnabled()) { | ||
if (event.type === 'SUBTASK' && task.hasSubtasks()) { | ||
this.verboseRenderer(task.subtasks); | ||
} | ||
else if (event.type === 'STATE') { | ||
const taskTitle = task.hasTitle() ? task.title : 'Task without title.'; | ||
if (task.isPending()) { | ||
this.logger.start(taskTitle); | ||
end() { } | ||
verboseRenderer(tasks) { | ||
return tasks === null || tasks === void 0 ? void 0 : tasks.forEach((task) => { | ||
task.subscribe((event) => { | ||
if (task.isEnabled()) { | ||
if (event.type === 'SUBTASK' && task.hasSubtasks()) { | ||
this.verboseRenderer(task.subtasks); | ||
} | ||
else if (task.isCompleted()) { | ||
this.logger.success(taskTitle); | ||
else if (event.type === 'STATE') { | ||
const taskTitle = task.hasTitle() ? task.title : 'Task without title.'; | ||
if (task.isPending()) { | ||
this.logger.start(taskTitle); | ||
} | ||
else if (task.isCompleted()) { | ||
this.logger.success(taskTitle); | ||
} | ||
} | ||
} | ||
else if (event.type === 'DATA') { | ||
if (task.hasFailed()) { | ||
this.logger.fail(String(event.data)); | ||
else if (event.type === 'DATA') { | ||
if (task.hasFailed()) { | ||
this.logger.fail(String(event.data)); | ||
} | ||
else if (task.isSkipped()) { | ||
this.logger.skip(String(event.data)); | ||
} | ||
else { | ||
this.logger.data(String(event.data)); | ||
} | ||
} | ||
else if (task.isSkipped()) { | ||
this.logger.skip(String(event.data)); | ||
else if (event.type === 'TITLE') { | ||
this.logger.title(String(event.data)); | ||
} | ||
else { | ||
this.logger.data(String(event.data)); | ||
} | ||
} | ||
else if (event.type === 'TITLE') { | ||
this.logger.title(String(event.data)); | ||
} | ||
} | ||
}, (err) => { | ||
this.logger.fail(err); | ||
}, (err) => { | ||
this.logger.fail(err); | ||
}); | ||
}); | ||
}); | ||
} | ||
} | ||
} | ||
VerboseRenderer.nonTTY = true; | ||
return VerboseRenderer; | ||
})(); | ||
exports.VerboseRenderer = VerboseRenderer; | ||
VerboseRenderer.nonTTY = true; | ||
//# sourceMappingURL=verbose.renderer.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.logLevels = void 0; | ||
var logLevels; | ||
@@ -4,0 +5,0 @@ (function (logLevels) { |
@@ -6,2 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Logger = void 0; | ||
const chalk_1 = __importDefault(require("chalk")); | ||
@@ -8,0 +9,0 @@ const figures_1 = __importDefault(require("figures")); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.createPrompt = exports.newPrompt = void 0; | ||
const prompts_1 = require("enquirer/lib/prompts"); | ||
@@ -4,0 +5,0 @@ const listr_interface_1 = require("../interfaces/listr.interface"); |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getRenderer = void 0; | ||
const default_renderer_1 = require("../renderer/default.renderer"); | ||
@@ -4,0 +5,0 @@ const silent_renderer_1 = require("../renderer/silent.renderer"); |
{ | ||
"name": "listr2", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "Terminal task list reborn! Create beautiful CLI interfaces via easy and logical to implement task lists that feel alive and interactive.", | ||
@@ -65,27 +65,27 @@ "license": "MIT", | ||
"log-update": "^4.0.0", | ||
"nanoid": "^3.1.9", | ||
"p-map": "^4.0.0", | ||
"pad": "^3.2.0", | ||
"rxjs": "^6.5.5", | ||
"through": "^2.3.8", | ||
"uuid": "^7.0.2" | ||
"through": "^2.3.8" | ||
}, | ||
"devDependencies": { | ||
"@cenk1cenk2/eslint-config": "*", | ||
"@types/jest": "^25.2.1", | ||
"@types/node": "^13.13.5", | ||
"@types/jest": "^25.2.3", | ||
"@types/node": "^14.0.1", | ||
"@types/rewire": "^2.5.28", | ||
"cz-conventional-changelog": "3.2.0", | ||
"delay": "^4.3.0", | ||
"eslint": "^6.8.0", | ||
"eslint": "^7.0.0", | ||
"husky": "^4.2.5", | ||
"jest": "^26.0.1", | ||
"lint-staged": "^10.2.2", | ||
"lint-staged": "^10.2.4", | ||
"prettier": "^2.0.5", | ||
"rewire": "^5.0.0", | ||
"rimraf": "^3.0.2", | ||
"ts-jest": "^25.5.0", | ||
"ts-jest": "^26.0.0", | ||
"ts-node": "^8.10.1", | ||
"tsconfig-paths": "^3.9.0", | ||
"tscpaths": "^0.0.9", | ||
"typescript": "^3.8.3" | ||
"typescript": "^3.9.2" | ||
}, | ||
@@ -92,0 +92,0 @@ "config": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
138434
1430
+ Addednanoid@^3.1.9
+ Addednanoid@3.3.7(transitive)
- Removeduuid@^7.0.2
- Removeduuid@7.0.3(transitive)