Skip to content

Commit

Permalink
perf: update api and rename for consistency
Browse files Browse the repository at this point in the history
BREAKING CHANGE: err field in manager has been renamed to errors as well
  • Loading branch information
cenk1cenk2 committed Mar 19, 2023
1 parent 65bd51b commit ffbe9f2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,15 @@ import type { ListrError, ListrBaseClassOptions, ListrContext, ListrSubClassOpti
* Useful for creating a single instance of Listr2 with pre-set settings.
*/
export class Manager<Ctx = ListrContext, Renderer extends ListrRendererValue = 'default', FallbackRenderer extends ListrRendererValue = 'verbose'> {
public err: ListrError[] = []
public errors: ListrError[] = []
private tasks: ListrTask<ListrContext, ListrGetRendererClassFromValue<Renderer>>[] = []

constructor (public options?: ListrBaseClassOptions<Ctx, Renderer, FallbackRenderer>) {}

get ctx (): Ctx {
return this.options.ctx
}

set ctx (ctx: Ctx) {
this.options.ctx = ctx
}
Expand Down Expand Up @@ -80,7 +84,7 @@ export class Manager<Ctx = ListrContext, Renderer extends ListrRendererValue = '
const ctx = await task.run()

// reset error queue
this.err = task.errors
this.errors = task.errors

return ctx
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils/ui/spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { isUnicodeSupported } from '@utils'

/* istanbul ignore next */
export class Spinner {
protected readonly spinner: string[] = !isUnicodeSupported() ? [ '-', '\\', '|', '/' ] : [ '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' ]
private id?: NodeJS.Timeout
private readonly spinner: string[] = !isUnicodeSupported() ? [ '-', '\\', '|', '/' ] : [ '⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏' ]

private spinnerPosition = 0

Expand Down

0 comments on commit ffbe9f2

Please sign in to comment.