Fix promptForBoolean to display the default initial value capitalized #1829
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
We should be passing in a boolean value into the
initial
property forConfirm()
: https://github.com/enquirer/enquirer/blob/70bdb0fedc3ed355d9d8fe4f00ac9b3874f94f61/lib/prompts/confirm.js#L8However, since we convert it to a string, it will always evaluate to true and display
Y/n
for everything:vip-cli/src/lib/dev-environment/dev-environment-cli.ts
Line 614 in 36ec126
This is because
ConfirmQuestionOptions
expects a string forinitial
(it inherits fromvip-cli/types/enquirer/index.d.ts
Line 770 in 36ec126
If we want to fix it in the Types definition, I think we need to change
initial?: T | ( () => Promise< T > | T );
toinitial?: T | ( () => Promise< T > | T ) | boolean | ( () => Promise< boolean > | boolean );
underexport type Question< T extends types.Answer = string, P extends Prompt< T > = Prompt< T > > = {
^ Happy to go about this way too and leave a comment in the PR
Pull request checklist
New release checklist
Steps to Test
Outline the steps to test and verify the PR here.
Example:
npm run build
vip dev-env create
and expect to display asEnable Elasticsearch (needed by Enterprise Search)? (y/N)