Skip to content
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

feat(inquirer): implement createPromptSession #1557

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

mshima
Copy link
Contributor

@mshima mshima commented Sep 17, 2024

Related to #1527.

@mshima mshima changed the title implement createPromptSession feat: implement createPromptSession Sep 17, 2024
@mshima mshima changed the title feat: implement createPromptSession feat(inquirer): implement createPromptSession Sep 17, 2024
Copy link

codecov bot commented Sep 17, 2024

Codecov Report

Attention: Patch coverage is 93.17073% with 14 lines in your changes missing coverage. Please review.

Please upload report for BASE (main@bd45397). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/inquirer/src/ui/prompt.mts 92.92% 14 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1557   +/-   ##
=======================================
  Coverage        ?   98.07%           
=======================================
  Files           ?       39           
  Lines           ?     2442           
  Branches        ?      651           
=======================================
  Hits            ?     2395           
  Misses          ?       40           
  Partials        ?        7           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mshima mshima marked this pull request as draft September 17, 2024 16:42
@mshima mshima force-pushed the subject branch 3 times, most recently from 1d34dd5 to 8927649 Compare September 17, 2024 18:32
question.askAnswered !== true &&
_.get(this.answers, question.name) !== undefined
) {
if (question.askAnswered !== true && this.answers[question.name] !== undefined) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break where name contains a sub-path like name: 'foo.bar' (which is why _.get was used)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's using a proxy.
Tests are in place for sub-paths.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I missed that. I think it's fair to do internally, but I'm unclear why we want to expose the capacity to provide a proxy as argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to provide a custom store.
It's possible to use a proxy or implement an api.

This is actually required to simplify supporting untouched inquirer api.
So Observables are supported by loading the question answer on demand.
Currently the prefilled answers are built from questions array.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a feature request, I can drop it.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not against it if there's a use-case. Just want to make sure we don't add unnecessary complexity we then need to support in "perpetuity". Or open doors for people to unnecessarily overcomplexify their implementations.

@SBoudrias
Copy link
Owner

I like the concept/interface, I'd really prefer to eventually move out rxjs from inquirer and into a wrapper. Most people do not use the reactive interface, and rxjs is a very large package that end up loaded in all those CLIs for no values.

@mshima mshima marked this pull request as ready for review September 18, 2024 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants