Skip to content

Conversation

@gksander
Copy link
Contributor

@gksander gksander commented Aug 11, 2022

create-spectacle prompts

This PR adds prompts to the create-spectacle package, so that users do not need to remember flags (although flags are still available). Some things to note:

  • If you pass all possible flags, and you're not trying to overwrite a folder, we bypass prompts.
  • All four prompts (name, type, lang, port) are shown – but have default values based on args/flags.
  • I tried damn hard to test this, but woah. What a challenge. Writing tests around dynamic stdout/stdin with these interactive prompts was tough and flakey and I just couldn't pull it off in the time I allotted for it. Something I wouldn't mind looping back to, but decided to cut my losses for the week.

Prompt flow

cs-prompt1

All flags, no prompts

cs-prompt2

@gksander gksander marked this pull request as draft August 11, 2022 17:02
@gksander gksander marked this pull request as ready for review August 11, 2022 17:43
@gksander gksander requested a review from carloskelly13 August 11, 2022 17:43
Copy link
Contributor

@carloskelly13 carloskelly13 left a comment

Choose a reason for hiding this comment

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

In file-writers.ts let's remove await rm(outPath, { recursive: true, force: true }); which deletes the directory no matter what.

Copy link
Contributor

@carloskelly13 carloskelly13 left a comment

Choose a reason for hiding this comment

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

This looks great but let's remove mdx for now since it doesn't generate anything yet. That's the last part to implement for both flags and prompts.

@gksander gksander requested a review from carloskelly13 August 11, 2022 19:14
@gksander gksander merged commit d12d7e8 into main Aug 12, 2022
@gksander gksander deleted the create-spectacle-prompts branch August 12, 2022 13:14
@github-actions github-actions bot mentioned this pull request Aug 12, 2022
ZimChristine pushed a commit to ZimChristine/spectacle that referenced this pull request Aug 16, 2022
* Initial prompts setup

* Overwrite flags

* Update e2e tests

* Add package README, allow for prompt bypass for onepage if no port provided

* Remove mdx as option

* Explicate boolean logic a bit

* Add changeset

* Remove mdx from README
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.

3 participants