1. 21
    Add prompts to an Nx Workspace Generator
    52s

Add prompts to an Nx Workspace Generator

Share this video with your friends

Social Share Links

Send Tweet
Published 3 years ago
Updated 2 years ago

To improve the execution of our Nx workspace generator we can add prompts to our generator configuration. In that way, when users run the workspace generator and some argument is missing, it would prompt the user with a question we can define. This leads to a much-improved experience.

Prefer to read along as well? Here's the accompanying article.

Instructor: [0:00] Right now, if we invoke our custom workspace generator and we forget to provide some of the required information, for instance, let's say yet-another-article, but we don't provide the author, Nx correctly fails and provides information that the author is missing.

[0:17] Now, we can improve this whole developer experience by providing some prompts for all of these properties. We can go here and add the x-prompt property and add some question, which the user can answer to, "Title of your new article?" Similarly, we can add here, "What's the name of the author?"

[0:36] If we save this now and retry to execute the workspace generator -- we can even remove the title -- we will get a question, "What's the title of your article?" so, Hello Egghead. "What's the name of the author?" Yuri. We go ahead and create my new Hello Egghead article.

egghead
egghead
~ 27 minutes ago

Member comments are a way for members to communicate, interact, and ask questions about a lesson.

The instructor or someone from the community might respond to your question Here are a few basic guidelines to commenting on egghead.io

Be on-Topic

Comments are for discussing a lesson. If you're having a general issue with the website functionality, please contact us at support@egghead.io.

Avoid meta-discussion

  • This was great!
  • This was horrible!
  • I didn't like this because it didn't match my skill level.
  • +1 It will likely be deleted as spam.

Code Problems?

Should be accompanied by code! Codesandbox or Stackblitz provide a way to share code and discuss it in context

Details and Context

Vague question? Vague answer. Any details and context you can provide will lure more interesting answers!

Markdown supported.
Become a member to join the discussionEnroll Today