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

Added prompt, if the directory already exists #9362

Merged

Conversation

ahaywood
Copy link
Contributor

Notion ID: CTL-292

Feature description

Before

With Create Redwood App, if the user specified a directory that already existed, the app would quit.

After

Now, if the directory already exists, then the user is presented with an additional prompt:

<DIRECTORY_NAME> already exists and is not empty. 

How would you like to proceed?
- Overwrite files and continue install
- Specify a different directory
- Quit and install

Screenshot:
CleanShot 2023-10-31 at 14 10 03


This was the original PR: #8854

  • Some changes were made to Create Redwood App since I last worked on this. It just seemed easier to create a new branch
  • I implemented the change requests
    • Bug where the target directory wasn't being listed (Reference)
    • Changed the order of options listed. Quit install is listed first and pre-selected. (Reference)
    • Removed the "You can use the 'overwrite' flag" text (Reference)

- If the directory already exists, it wasn't applying the new directory name everywhere
@ahaywood ahaywood requested review from Tobbe and jtoar October 31, 2023 19:15
@ahaywood ahaywood changed the title Ad create redwood app/directory already exists Added prompt, if the directory already exists Oct 31, 2023
Originally I wrote this code for reference. Doesn’t need to be in the final code.
@ahaywood ahaywood self-assigned this Nov 7, 2023
@ahaywood ahaywood added the crwa-ok Override the CRWA check label Nov 7, 2023
@ahaywood
Copy link
Contributor Author

ahaywood commented Nov 7, 2023

@Tobbe I implemented the changes you requested. Would you mind taking another look?

Copy link

@Tobbe
Copy link
Member

Tobbe commented Nov 18, 2023

I tried this locally and I think I found an issue
image

It seems it's not handling ~ correctly when I use it to specify a new directory, but it worked just fine for the initial directory I specified as an argument

@Tobbe
Copy link
Member

Tobbe commented Nov 18, 2023

This is how it works now:

First I try with a directory that already exists and get prompted for a new path.
I try with ~tobbe/... and get an error, and is again prompted for a new path.
I try with ~/... and that works (thanks to the untilde library that we already used for another prompt in this script)

image

And just to demonstrate that the ~username syntax works on the command line

image

And the reason it works there is that it's the shell that does the tilde expansion, and not Node.

@Tobbe Tobbe added the release:feature This PR introduces a new feature label Nov 18, 2023
@Tobbe Tobbe added this to the next-release milestone Nov 18, 2023
@Tobbe Tobbe merged commit 8c4a520 into redwoodjs:main Nov 18, 2023
33 of 36 checks passed
jtoar pushed a commit that referenced this pull request Nov 29, 2023
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
jtoar pushed a commit that referenced this pull request Nov 29, 2023
Co-authored-by: Tobbe Lundberg <tobbe@tlundberg.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crwa-ok Override the CRWA check release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants