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

Async follow up prompts #441

Open
cduivis opened this issue Jun 7, 2024 · 0 comments
Open

Async follow up prompts #441

cduivis opened this issue Jun 7, 2024 · 0 comments

Comments

@cduivis
Copy link

cduivis commented Jun 7, 2024

Disclaimer: Maybe not so much be an issue per se as an question / feature request.

Context:
We have a folder structure in our project containing a lot of styles and variables for those styles.
These styles are overwritable for different clients in the project.
I want to use plop to create a wizard for other project members to automatically generate all or a part of those client styles (depending on their needs).

The problem:
I need to have follow up questions based on previously made choices.
In some of those follow up questions I want to first read a part of the file system structure which will enrich the options that are asked in the follow prompt. The problem with this is that I don't know how I can run async behavior before a prompt is running.

What I've tried:

  1. Creating my own async action which collects data and then tries to retrigger custom prompts by using await plop.inquirer.prompt(). Collection of data works perfectly but triggering the prompt does not sadly results in the cli to just shows a spinner and not the prompt I triggered.
  2. Registering an async function as a new Prompt in the hopes I can scaffold filesystem information there which then triggers a normal inquirer prompt. This errored before I even got to a breakpoint in the function.

Maybe I'm reaching beyond the capabilities of this framework.
But I'm curious to learn if there are already ways to:

  1. trigger different follow up prompts based on the answer of the previous prompt;
  2. enrich an inquirer list prompt with async-ly gathered options.
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

No branches or pull requests

1 participant