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.jsversion 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.
rxjshas been dropped in favor of an event-emitter-based approach witheventemitter3. This will possibly break every custom renderer since custom-renderers might rely onsubscribeon Task. The refactoring is nothing very marginal where you can compare the current and old VerboseRenderer for guidance.- The Listr and Manager
errfields have been renamed toerrorsfor consistency. - DefaultRenderer default output format, which handles fitting the rendered data inside the terminal columns, has been changed from
truncatetowrap, since it is the more logical choice to display all the output data. - The Listr options
nonTTYRendererandnonTTYRendererOptionshave been renamed tofallbackRenderer,fallbackRendererOptionsrespectively for consistency. - The Listr options
fallbackConditionandsilentConditionhave been renamed tofallbackRendererCondition,silentRendererConditionrespectively for consistency. - The Listr option
collectErrorsdefault behavior has been changed from'minimal'tofalsesince this is the most underused functionality and decided that it should be opt-in for saving some memory. - The Listr property
pathwhich 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
LoggertoListrLogger, 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
colorthroughcolorretteetc. without bringing your own library. - DefaultRenderer, VerboseRenderer and SimpleRenderer now use pluggable components for timestamps and task time parsing.
- DefaultRenderer options
collapsewhich corresponded whether the subtasks would be collapsed or not is renamed tocollapseSubtasksfor consistency. - DefaultRenderer option
suffixSkipsnow has the default value offalsewhere it would not have[SKIPPED]at the end of the task. - VerboseRenderer no longer has the field
logEmptyTitleand 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
PENDINGhas been renamed toSTARTEDand ListrEventTypeDATAhas been renamed toOUTPUTfor consistency. - ListrTaskRetry which is the output of the
task.isRetrying()now holds the error value inerrorinstead of priorwithError. - The Listr now has additional options to
forceColorandforceTTYsince this was a complaint. - To use up-to-date dependencies, everything development related in the repository has been converted to
esmand DefaultRenderer now imports anythingesmthrough dynamical imports. - Prompts in the tasks now have their channel, which might break your custom renderer implementation.