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

CRWA: Prompt for installation dir #8955

Merged
merged 5 commits into from
Jul 25, 2023

Conversation

Tobbe
Copy link
Member

@Tobbe Tobbe commented Jul 24, 2023

Instead of failing if the user didn't provide a dir on the command line, let's prompt for one!

I was inspired by t3 where you don't have to specify any arguments at all to get started
image

This is what our implementation looks like now
Default suggestion my-redwood-app
image

And here's when it's done
image

Here's with a couple of options specified as arguments/flags
image

@Josh-Walker-GM Can you please double check I didn't mess anything up with Telemetry?
@ahaywood Hope I'm not stepping on your toes here 🦶

@Tobbe Tobbe added the release:feature This PR introduces a new feature label Jul 24, 2023
@Tobbe Tobbe added this to the next-release milestone Jul 24, 2023
Copy link
Collaborator

@Josh-Walker-GM Josh-Walker-GM left a comment

Choose a reason for hiding this comment

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

LGTM from a telemetry perspective. I tested locally and could see the new error state being recorded and from looking at the changes I can't see how this would break anything else.

@Josh-Walker-GM
Copy link
Collaborator

@Tobbe I testing this locally just by building the package and then running node ./dist/create-redwood-app.js. I noticed slightly different behaviour between specifying it as an arg or in response to the prompt.

If I ran node ./dist/create-redwood-app.js ~/crwa_test I get the project created at /home/josh/crwa_test. If I ran node ./dist/create-redwood-app.js and provided ~/crwa_test at the prompt then it created a new ~/crwa_test folder relative to my current directory and not at my home directory.

Are you able to confirm this? I think we'd aim for consistency here right or do we want it to be different?

Copy link
Member Author

Tobbe commented Jul 24, 2023

Ahh, yes. That's because your shell is doing path expansion if you pass it as an argument. But apparently that doesn't happen when it's just a prompt answer

Copy link
Member Author

Tobbe commented Jul 24, 2023

@Josh-Walker-GM Confirmed. Node does not support ~ on its own nodejs/node#684
We need to handle that ourselves (or find a package that does it for us)

@Josh-Walker-GM
Copy link
Collaborator

Ahh so obvious now you say it! I forget ~ isn't a "real" filesystem thing. Ignore that concern then as I'm happy to say that's what we should expect.

Copy link
Member Author

Tobbe commented Jul 24, 2023

I'm not so sure. I think we might still want to support it. Just need to figure out how! As you said - I think users would expect feature parity between cli args and prompt answers

@Tobbe
Copy link
Member Author

Tobbe commented Jul 24, 2023

@Josh-Walker-GM Please try again. ~/tmp/rw-app-tilde works for me now as a prompt answer

@Josh-Walker-GM
Copy link
Collaborator

Great works for me too!

@Tobbe
Copy link
Member Author

Tobbe commented Jul 24, 2023

At first I was just going to ignore this. But it bugged me too much, so I added error handling for it. It's such a super obscure edge case... You'd most likely need to be root to have write access to other users home directories. And I hope people aren't setting up RW apps as root users. Plus you need to use this uncommon ~username syntax that most people probably don't even know about...
image

@Tobbe Tobbe enabled auto-merge (squash) July 25, 2023 21:44
@Tobbe Tobbe merged commit 93f213d into redwoodjs:main Jul 25, 2023
27 checks passed
@jtoar jtoar modified the milestones: next-release, v6.0.0 Jul 26, 2023
jtoar pushed a commit that referenced this pull request Jul 26, 2023
Instead of failing if the user didn't provide a dir on the command line,
let's prompt for one!

I was inspired by t3 where you don't have to specify any arguments at
all to get started

![image](https://github.com/redwoodjs/redwood/assets/30793/575775c1-555e-4e0f-851a-cd2bad49b5a9)

This is what our implementation looks like now
Default suggestion `my-redwood-app`

![image](https://github.com/redwoodjs/redwood/assets/30793/738856e9-e6f3-436d-bb56-a74ffc44ead2)

And here's when it's done

![image](https://github.com/redwoodjs/redwood/assets/30793/55893785-52e3-41a2-9b75-1f88c4380293)

Here's with a couple of options specified as arguments/flags

![image](https://github.com/redwoodjs/redwood/assets/30793/df65951c-b8aa-41f4-b586-11121f20a2be)

@Josh-Walker-GM Can you please double check I didn't mess anything up
with Telemetry?
@ahaywood Hope I'm not stepping on your toes here 🦶
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:feature This PR introduces a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants