Comparing version 1.2.5 to 1.2.6
@@ -5,2 +5,3 @@ /// <reference types="node" /> | ||
import { stateConstants } from '../constants/state.constants'; | ||
import { Task } from '../lib/task'; | ||
import { Listr } from '../listr'; | ||
@@ -10,3 +11,3 @@ import { PromptOptionsType, PromptTypes } from '../utils/prompt.interface'; | ||
export declare class ListrClass<Ctx = ListrContext> { | ||
tasks: ListrTaskObject<Ctx>[]; | ||
tasks: Task<Ctx>[]; | ||
constructor(task?: readonly ListrTask<Ctx>[], options?: ListrOptions<Ctx>); | ||
@@ -48,3 +49,3 @@ run(ctx?: Ctx): Promise<Ctx>; | ||
output: string; | ||
newListr<Ctx = ListrContext>(task: ListrTask<Ctx>[], options?: ListrOptions): Listr; | ||
newListr<Ctx = ListrContext>(task: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): Listr; | ||
report(error: Error): void; | ||
@@ -51,0 +52,0 @@ skip(message: string): void; |
@@ -6,7 +6,7 @@ import { Listr } from '../listr'; | ||
add<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[]): void; | ||
injectOptions<Ctx = InjectCtx>(options?: ListrOptions<Ctx>): void; | ||
runAll<Ctx = InjectCtx>(options?: ListrOptions<Ctx>): Promise<Ctx>; | ||
run<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): Promise<Ctx>; | ||
newListr<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): Listr<Ctx>; | ||
indent<Ctx = ListrContext>(tasks: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): ListrTask<Ctx>; | ||
getRunTime(pipetime: number): string; | ||
} |
@@ -1,5 +0,5 @@ | ||
import { ListrClass, ListrContext, ListrOptions, ListrRendererClass, ListrTask, ListrError } from './interfaces/listr.interface'; | ||
import { ListrClass, ListrContext, ListrError, ListrOptions, ListrRendererClass, ListrTask } from './interfaces/listr.interface'; | ||
export declare class Listr<Ctx = ListrContext> implements ListrClass { | ||
task: ListrTask<Ctx>[]; | ||
options?: ListrOptions; | ||
task: ListrTask<Ctx> | ListrTask<Ctx>[]; | ||
options?: ListrOptions<Ctx>; | ||
tasks: ListrClass['tasks']; | ||
@@ -9,6 +9,5 @@ err: ListrError[]; | ||
rendererClass: ListrRendererClass<Ctx>; | ||
context: Ctx; | ||
private concurrency; | ||
private renderer; | ||
constructor(task: ListrTask<Ctx>[], options?: ListrOptions); | ||
constructor(task: ListrTask<Ctx> | ListrTask<Ctx>[], options?: ListrOptions<Ctx>); | ||
add(task: ListrTask | ListrTask[]): void; | ||
@@ -15,0 +14,0 @@ run(context?: Ctx): Promise<Ctx>; |
@@ -13,3 +13,2 @@ "use strict"; | ||
constructor(task, options) { | ||
var _a; | ||
this.task = task; | ||
@@ -36,3 +35,2 @@ this.options = options; | ||
this.exitOnError = this.options.exitOnError; | ||
this.context = (_a = this.options) === null || _a === void 0 ? void 0 : _a.ctx; | ||
this.add(task || []); | ||
@@ -47,2 +45,3 @@ } | ||
async run(context) { | ||
var _a; | ||
if (!this.renderer) { | ||
@@ -52,3 +51,3 @@ this.renderer = new this.rendererClass(this.tasks, this.options); | ||
this.renderer.render(); | ||
context = context || this.context || Object.create({}); | ||
context = context || ((_a = this.options) === null || _a === void 0 ? void 0 : _a.ctx) || Object.create({}); | ||
const errors = []; | ||
@@ -67,3 +66,2 @@ await this.checkAll(context); | ||
this.renderer.end(); | ||
return context; | ||
} | ||
@@ -77,2 +75,3 @@ catch (error) { | ||
} | ||
return context; | ||
} | ||
@@ -79,0 +78,0 @@ checkAll(context) { |
import { ListrContext, ListrOptions, ListrTask } from './interfaces/listr.interface'; | ||
import { Listr } from './listr'; | ||
export declare class Manager<InjectCtx = ListrContext> { | ||
private options?; | ||
private tasks; | ||
constructor(options?: ListrOptions<InjectCtx>); | ||
add<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): void; | ||
runAll<Ctx = InjectCtx>(options?: ListrOptions<Ctx>): Promise<Ctx>; | ||
newListr<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): Listr<Ctx>; | ||
indent<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): ListrTask<Ctx>; | ||
run<Ctx = InjectCtx>(tasks: ListrTask<Ctx>[], options?: ListrOptions<Ctx>): Promise<Ctx>; | ||
getRuntime(pipetime: number): string; | ||
} |
@@ -5,15 +5,9 @@ "use strict"; | ||
class Manager { | ||
constructor(options) { | ||
this.options = options; | ||
constructor() { | ||
this.tasks = []; | ||
this.options = Object.assign({}, options); | ||
} | ||
add(tasks, options) { | ||
const newTask = { | ||
task: (ctx, task) => task.newListr(tasks, options) | ||
}; | ||
this.tasks = [...this.tasks, newTask]; | ||
this.tasks = [...this.tasks, this.indent(tasks, options)]; | ||
} | ||
async runAll(options) { | ||
options = Object.assign(this.options, options); | ||
const ctx = await this.run(this.tasks, options); | ||
@@ -26,2 +20,8 @@ this.tasks = []; | ||
} | ||
indent(tasks, options) { | ||
const newTask = { | ||
task: () => this.newListr(tasks, options) | ||
}; | ||
return newTask; | ||
} | ||
run(tasks, options) { | ||
@@ -28,0 +28,0 @@ return this.newListr(tasks, options).run(); |
@@ -57,3 +57,3 @@ /// <reference types="node" /> | ||
newline?: string; | ||
fields: BasePromptOptions[]; | ||
fields: Partial<BasePromptOptions[]>; | ||
template: string; | ||
@@ -60,0 +60,0 @@ } |
{ | ||
"name": "listr2", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "Terminal task list reborn!", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
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
72787
1087