-
Notifications
You must be signed in to change notification settings - Fork 380
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
fix: follow standard pattern for auto-generated site names #5007
Conversation
📊 Benchmark resultsComparing with 85f961d Package size: 227 MB⬇️ 0.05% decrease vs. 85f961d
Legend
|
The longest possible site name suggestion is For deploy previews, a 24 char hash is pre-pended (as per #4653 (comment)) which would make the max length 60 (34 + 24 + 2 for A suggestion should never cross the length of 37 characters (63 - (24 + 2)) In all cases, the URLs stay below the 63 char length which keeps everything functional. |
3eb8386
to
03d545b
Compare
I have mixed feelings about this. I do not like the code duplication from the server-side. In case we ever decide to change the logic server-side this can create problems again. What if instead of creating a name on the client we simply do not do this at all? If the API call Do you see any problem with this? |
Only issue with this is that it seems like the site name is going to be empty & there's no indication of what it's going to be. Although, the Netlify UI also does the same thing (assign name without pre-indication). I'll make the changes if you feel its necessary. Will need to update the CLI prompts a bit to indicate that an auto-generated name will be assigned. Flow with auto-generated suggestion visible. (Current behaviour) |
I personally feel this is okay if we add a message like Ping @netlify/developer-experience-members What is your take on this? Any recommendations? |
Something like I left |
How about The prompt in the CLI would then be:
|
But how does someone |
I didn't want to use I do agree that |
You know, I'm not sure we need a message if the auto-generated name is a suggestion like in the image above from @tinfoil-knight. I just ran through setting up a new git repo via the GitHub CLI for inspiration. All (lighter contrast) prompts are e.g. Maybe we just need to show the auto generated name without an extra message. That feels more intuitive to me. What do you think? |
@whitep4nth3r I like the auto-generated name option from a user's PoV but the issue with this is that it uses code that relies on internal server implementation (Netlify API) of how the site names are generated which makes it brittle which is why @danez suggested to avoid doing this in #5007 (comment) |
Oh I see, that makes sense. So the options are along the lines of:
I wonder whether we can get a bit of Netlify personality in here. Maybe I'm over-thinking it but there's maybe an opportunity to be a little quirky here given we can't show the auto-generated name. Along the lines of....?
Maybe we have an array of quirky strings to show a random one out of a selection each time? Am I going too far? 😅 |
@danez I'll go forward with this & make changes to the flow to rely on the server for generating names if left empty. @whitep4nth3r If you come up with any other ideas in the meantime, just let me know. |
Change Summary Edit: Everything below is outdated now since the default value that displayed
The If a repository with the same name is already present, the user will get a well defined error. The site name will be selected by the server if not provided. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@danez Let me know if any additional tests are required.
src/commands/sites/sites-create.js
Outdated
const { name: nameInput } = await inquirer.prompt([ | ||
{ | ||
type: 'input', | ||
name: 'name', | ||
message: 'Site name (you can change it later):', | ||
default: siteSuggestion, | ||
default: 'Pick for me', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should be using the default
property like this. We're assigning it a value that we know we won't use, just for the purpose of displaying something.
Instead, can we change message
so that it reads something like Site name (leave blank for a random name; you can change it later)
, and we assign a value if the value is empty?
If we absolutely must use the current approach, let's please move the string to a constant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change it. I find the current approach a bit "hacky" too.
9883cf2
to
fd28bd0
Compare
Not sure as to what's happening with the failing tests here: https://github.com/netlify/cli/actions/runs/2993351770 |
I'm not working till end of September. So i can look then or someone else does. Sorry |
@danez Can you take a look at the tests here now? They seem to be timing out. Still not sure what's causing this. |
@tinfoil-knight I rebased on the current main branch and fixed the tests. It seems the tests match on the exact input line. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thank you a lot for fixing the tests @danez. |
This is awesome! Here I was going to post a list of the words we use to generate the site names in Netlify, and I see y'all settled on a better solution. ✨ |
🎉 Thanks for submitting a pull request! 🎉
Summary
Fixes #4630
Fixes #4653
The suggestions for auto-generated site names from the CLI don't follow the same pattern as they do when created from the Netlify App. These suggestions also use a very limited number of combinations which results in a user having a lot of site names being very similar & not being able to discern b/w them.
Additionally, the suggested site names can lead to invalid URLs as described here: #4653 (comment)
This PR fixes both the issue with standard names & site length. Also see #5007 (comment)
For us to review and ship your PR efficiently, please perform the following steps:
passes our tests.
A picture of a cute animal (not mandatory, but encouraged)