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

Prompt to confirm upgrade #11601

Merged
merged 5 commits into from
Dec 27, 2024
Merged

Conversation

pantheredeye
Copy link
Collaborator

Added a prompt after running yarn rw upgrade to confirm before starting.

Motivation: I have upgraded a project twice, that I remember, on accident while looking for information about the latest upgrade. Right now, when a user runs yarn rw upgrade the process starts immediately. This check adds a simple prompt to the beginning of listr tasks to confirm if they want to upgrade the project.

Thoughts:

The prompt method is taken from other cli commands using a prompt. It defaults to adding (Y/n) >> true to the end of the prompt. I don't like the mismatch in terms. But, I can't figure out how to default it to 'yes' instead of true.

I looked for tests related to the upgrade command, but didn't find them.

Screenshots:

Prompt:
image

Upgrade Cancelled:
image

Upgrade Confirmed:
image

@pantheredeye
Copy link
Collaborator Author

Fails smoke tests... I would need to update these if this goes through. I might need to be pointed in the right direction to do this!

image

@pantheredeye
Copy link
Collaborator Author

@Tobbe my friend 🙏 - any thoughts on this one? I still like this concept... especially because running yarn rw upgrade will jump major versions on you without a prompt to confirm the start.

@Tobbe Tobbe added the release:feature This PR introduces a new feature label Dec 27, 2024
@Tobbe Tobbe added this to the next-release milestone Dec 27, 2024
@Tobbe
Copy link
Member

Tobbe commented Dec 27, 2024

@Tobbe my friend 🙏 - any thoughts on this one?

Let's do it! I'll take a look rn

@Tobbe
Copy link
Member

Tobbe commented Dec 27, 2024

I got a bit carried away with a couple of tweaks 😅

Added a --yes flag to be able to skip the prompt (to make automated workflows easier)
image

Default confirmation prompt:
image

After my edits:
image

(There's an open issue about the Confirm prompt defaults: enquirer/enquirer#334)

@pantheredeye let me know what you think about my changes. If you hate them all I can revert 😄

@pantheredeye
Copy link
Collaborator Author

@Tobbe these look good and the flag makes sense! LGTM! 😆 🚀

@Tobbe Tobbe merged commit 424f5af into redwoodjs:main Dec 27, 2024
50 checks passed
@Tobbe Tobbe added release:breaking This PR is a breaking change and removed release:feature This PR introduces a new feature labels Dec 27, 2024
@Tobbe
Copy link
Member

Tobbe commented Dec 27, 2024

I just realized this is breaking for anyone who might have yarn rw upgrade in some sort of automated workflow as they now need to answer the prompt or pass --yes.

@pantheredeye
Copy link
Collaborator Author

good catch! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:breaking This PR is a breaking change
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants