yargs-interactive icon indicating copy to clipboard operation
yargs-interactive copied to clipboard

feat(interactive-mode): Added option to enable support of inquirer plugins

Open TheOptimisticFactory opened this issue 5 years ago • 2 comments

Main changes

  • Added option to enable support of inquirer plugins, which defaults to false when not provided. As the result, this PR preserves backward-compatibility.

TheOptimisticFactory avatar Jul 21 '20 13:07 TheOptimisticFactory

Pinging @nanovazquez just in case, as it seems I cannot request a review :)

TheOptimisticFactory avatar Jul 22 '20 17:07 TheOptimisticFactory

I was just about to create a PR with something like this in it. Our use case is that we use various Inquirer plugins such as inquirer-fuzzy-path, etc. -- and because the existing code calls createPromptModule, any questions processed by Inquirer that were defined using yargs-interactive cannot use any modules that we have registered with Inquirer, even if we register them at the very top of the first file we load.

As far as backwards compatibility -- there's actually not even any real reason to use createPromptModule() at all in yargs-interactive, because yargs-interactive doesn't even call registerModule(). Even if it did. you only really need to use createPromptModule() if you are about to register other modules against inquirer and you don't want any other consumers of inquirer to be effected by your registerModule() call. In practice, this only matters if you are about to override an existing inquirer prompt with something that has a different API than the original did. If all you're doing is adding new modules, that would not be a breaking change anyway.

So IMO it would be perfectly safe to just remove L9 entirely (const prompt = inquirer.createPromptModule();) and just call inquirer.promp() directly.

@nanovazquez Is this project maintained anymore?

MaximusHaximus avatar Nov 09 '20 07:11 MaximusHaximus