Migration
WARNING
If you encounter any more of the breaking changes, please feel free to contribute by editing this page.
The repository has been converted to a monorepo and some parts of it has been broken down in to smaller packages.
Since this is still a hybrid module transpiled for
cjs/esmimports, with the new changes for Typescriptv5.0.0+ should be fixed.Listr options
disableColorandforceColorhave been removed since they were not working as intended. Users are encouraged to use underlying environment variables for colorrette, which areFORCE_COLORandNO_COLOR.Environment variable
LISTR_DISABLE_COLORhas been removed in favor of using the underlying library'sNO_COLORoption instead to have consistency with other libraries.Task
optionsproperty, which is used for per-renderer task options has been deprecated in favor ofrendererOptionsandfallbackRendererOptionsto define the per-renderer task options. This change has been done to properly inject circular types, as well as, pass task options to fallback renderer.Manager is now its own seperate package that can be installed on demand through
@listr2/manager.task.prompthas been refactored to support multiple adapters, this will break the existing behavior but will bring the ability to use different prompt libraries. Nowinquireris also supported addition to initially supportedenquirer. Prompts adapters are in their respective packages of@listr2/prompt-adapter-enquirer,@listr2/prompt-adapter-inquirer.Old form:
typescriptimport { Listr } from 'listr2' await new Listr([ { task: async (ctx, task): Promise<void> => { ctx.input = await task.prompt<boolean>({ type: 'Toggle', message: 'Do you love me?' }) } } ]).run()Can be migrated with ease:
typescriptimport { Listr } from 'listr2' import { ListrEnquirerPromptAdapter } from '@listr2/prompt-adapter-enquirer' await new Listr([ { task: async (ctx, task): Promise<boolean> => { ctx.input = await task.prompt(ListrEnquirerPromptAdapter).run<boolean>({ type: 'Toggle', message: 'Do you love me?' }) } } ]).run()If you are using it in multiple places like canceling a prompt or asking multiple questions in a prompt, you can assign the adapter to a variable instead.
typescriptimport { Listr } from 'listr2' import { ListrEnquirerPromptAdapter } from '@listr2/prompt-adapter-enquirer' await new Listr([ { task: async (ctx, task): Promise<boolean> => { // create the adapter first const prompt = task.prompt(ListrEnquirerPromptAdapter) ctx.input = await prompt.run<boolean>({ type: 'Toggle', message: 'Do you love me?' }) ctx.input = await prompt.run<boolean>({ type: 'Toggle', message: 'And another one?' }) } } ]).run()Any
enquirerrelated exported types have been prefixed withEnquirer, e.g.PromptTypesbecameEnquirerPromptTypes.Listr option
injectWrapperhas been removed. This was only being used by the prompt system. Now you can inject anenquirerinstance through the adapter directly.There is a new
ListrTaskStatewhich isPROMPT_FAILED, that will be emitted whenever a prompt has failed.