Foreword
I am aware that breaking changes are inconvenient. Breaking changes that require you to refactor your code in this repository is rare and far between.
But this is a big update where a core component like rxjs
has been replaced with an event-emitter-based approach, which is required to refactor anything that is renderer related.
So in this update, custom renderers might take the biggest hit since rendering has been completely refactored.
While doing so I have decided to address one of the biggest problems with the repository. While using an updating renderer like DefaultRenderer, you might accidentally or unwillingly log into the console, where this completely breaks the underlying log-update
library. Now there is a ProcessOutput abstraction is in place to avoid this as much as we can.
The naming scheme of some options was inconsistent and was bugging me for a long-time. Some of the fields are just kept to be somewhat compatible with the original Listr library. Since this is no longer a concern of mine and this library is extended beyond it is compatibility with the original, I have taken the initiative to update some options with a more consistent naming scheme.
Migration
WARNING
If you encounter any more of the breaking changes, please feel free to contribute by editing this page.
node.js
version 16 is required as a minimum since support for version 14 has been terminated.- The fallback renderer default has been changed from VerboseRenderer to SimpleRenderer since it is mostly non-TTY compatible if there are no prompts.
rxjs
has been dropped in favor of an event-emitter-based approach witheventemitter3
. This will possibly break every custom renderer since custom-renderers might rely onsubscribe
on Task. The refactoring is nothing very marginal where you can compare the current and old VerboseRenderer for guidance.- The Listr and Manager
err
fields have been renamed toerrors
for consistency. - DefaultRenderer default output format, which handles fitting the rendered data inside the terminal columns, has been changed from
truncate
towrap
, since it is the more logical choice to display all the output data. - The Listr options
nonTTYRenderer
andnonTTYRendererOptions
have been renamed tofallbackRenderer
,fallbackRendererOptions
respectively for consistency. - The Listr options
fallbackCondition
andsilentCondition
have been renamed tofallbackRendererCondition
,silentRendererCondition
respectively for consistency. - The Listr option
collectErrors
default behavior has been changed from'minimal'
tofalse
since this is the most underused functionality and decided that it should be opt-in for saving some memory. - The Listr property
path
which is mostly used for collecting the errors to find out the task hierarchy is now an array of strings instead of a joined string. - The ListrLogger implementation has been completely reworked and renamed from
Logger
toListrLogger
, anything that relies on it has to be reworked. - Most of the internal API of the library is now exported, so you can directly use functionality like
color
throughcolorrette
etc. without bringing your own library. - DefaultRenderer, VerboseRenderer and SimpleRenderer now use pluggable components for timestamps and task time parsing.
- DefaultRenderer options
collapse
which corresponded whether the subtasks would be collapsed or not is renamed tocollapseSubtasks
for consistency. - DefaultRenderer option
suffixSkips
now has the default value offalse
where it would not have[SKIPPED]
at the end of the task. - VerboseRenderer no longer has the field
logEmptyTitle
and skips tasks without titles instead of logging them as'Task without title.'
. - TestRenderer is encouraged to be used for testing purposes instead of VerboseRenderer.
- ListrTaskState
PENDING
has been renamed toSTARTED
and ListrEventTypeDATA
has been renamed toOUTPUT
for consistency. - ListrTaskRetry which is the output of the
task.isRetrying()
now holds the error value inerror
instead of priorwithError
. - The Listr now has additional options to
forceColor
andforceTTY
since this was a complaint. - To use up-to-date dependencies, everything development related in the repository has been converted to
esm
and DefaultRenderer now imports anythingesm
through dynamical imports. - Prompts in the tasks now have their channel, which might break your custom renderer implementation.