-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deps: replace inquirer with enquirer #12317
deps: replace inquirer with enquirer #12317
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking this on! Confirmed the behavior in the normal flows works correctly, just two comments on ctrl-c
support and a suggestion on formatting
const prompt = new Confirm({ | ||
name: 'isErrorReportingEnabled', | ||
initial: false, | ||
message: MESSAGE, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as mentioned in #6658 (comment), the question part of the prompt will have to be manually bolded if we want to preserve the old behavior (which I think still looks good and makes the question stand out).
I can't add a suggestion to L18 in the github UI, but it should just need to change to
` ${log.bold}May we anonymously report runtime exceptions to improve the tool over time?${log.reset} `; // eslint-disable-line max-len
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your kindly review 😍. I made the message bold again.
name: 'isErrorReportingEnabled', | ||
initial: false, | ||
message: MESSAGE, | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to take care of enquirer preventing ctrl-c
from working, I think the best approach (based on #6658 (comment) and a quick debug session...there may be a better way but I don't see it) is adding
}); | |
actions: {ctrl: {}}, | |
}); |
(and types/enquirer/index.d.ts
will also have to be updated)
This gets rid of all the ctrl-*
key handling, but since we're only using a y/N prompt, I don't think we're going to miss any of it (e.g. if it was free-form text entry we'd probably want to keep ctrl-a
and ctrl-e
, but we don't have that).
It's still a bit weird. ctrl-c
during the prompt still cancels the whole run, but answering yes or no and then doing ctrl-c
during the lighthouse run kills the lighthouse process but not the Chrome one. That's less than ideal, but it's better than ctrl-c
not doing anything, and this is only on the first run when the user is prompted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added actions
to the option. Also, I updated the path of .d.ts as suggested at #12305 (comment) (from types/enquirer/index.d.ts
to types/enquirer.d.ts
).
4608e31
to
99d1cdc
Compare
…takenspc:replace-inquirer-with-enquirer
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I resolved the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works great! Thanks for making this change happen.
Summary
The inquirer is one of the big dependencies as it depends on rxjs. Replacing inquirer with enquirer would reduce the install size.
My motivation is to make CI setup which runs lighthouse faster so that reducing dependencies is more important than devDependencies.
Screenshots of CLI with this change
Initial rendering:
![](https://user-images.githubusercontent.com/270905/113106567-dfc7b680-923d-11eb-92cc-7826c278a9b2.png)
Timeout reached (rejected):
![](https://user-images.githubusercontent.com/270905/113106595-e7875b00-923d-11eb-9b7c-cc4e8326e080.png)
Accepted:
![](https://user-images.githubusercontent.com/270905/113106619-f110c300-923d-11eb-8c88-11a39163431a.png)
Related Issues/PRs
#12305