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

Validate site name on init command #264

Merged
merged 2 commits into from Apr 4, 2019

Conversation

Projects
None yet
2 participants
@eduardoboucas
Copy link
Contributor

commented Mar 11, 2019

- Summary

When creating a new site using the web UI, the site name is subject to a validation rule that allows only alphanumeric characters and hyphens. The same doesn't happen when using the netlify init command in the CLI. This PR addresses that by introducing a validation rule with the same regular expression used in the web flow.

I've also added a few cosmetic changes to some user-facing messages in the init command, to make words like Netlify and GitHub capitalized in a consistent manner. I'm more than happy to make this a different PR (or discard it altogether), if you prefer.

- Test plan

I started writing an integration test, but then I saw that there is a big change to the testing architecture underway in #254. I didn't want to create possible merge conflicts, so I've refrained from committing the tests for now. Happy to revisit.

The change makes use of inquirer's validate method, which displays an error when the user tries to input an invalid value.

Screenshot 2019-03-11 at 12 58 54

The error message is consistent with the instructions shown in the web UI.

- Description for the changelog

Validates site name on init command. Closes #211.

- A picture of a cute animal (not mandatory but encouraged)

A picture of a cute dog

@bcomnes

bcomnes approved these changes Apr 4, 2019

Copy link
Contributor

left a comment

LGTM!

@bcomnes bcomnes merged commit d681c51 into netlify:master Apr 4, 2019

5 checks passed

netlify.cli Build #20190311.1 succeeded
Details
netlify.cli (Linux) Linux succeeded
Details
netlify.cli (Windows) Windows succeeded
Details
netlify.cli (macOS) macOS succeeded
Details
netlify/cli/deploy-preview Deploy preview ready!
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.