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

feat: convert project name to lowercase and warn on creation #5096

Conversation

haoqunjiang
Copy link
Member

@haoqunjiang haoqunjiang commented Jan 20, 2020

closes #2547
closes #5032

I'm still very hesitant about adding this feature, though.

Aside from the reasons mentioned in facebook/create-react-app#2165, here are my thoughts:

First, this change allows project creation in a folder with uppercase
letters in its name. It is strongly discouraged and may cause many
weird issues all over the ecosystem.

For example, #5022, #4424, #3665, #4174 are all
caused by case issues. Adding support for uppercase project names will
only worsen this situation.

Secondly, it adds a lot of maintenance burden on us. As noted in the
comments, these prompts are hard to test right now (because
createTestProject runs in another process so it's hard to intercept
the prompts). Even if such test utilities are added in the future, it's
still very tedious to take care of all the case issues in the test
suite.

What's worse is that we can affect the project folders created by
@vue/cli by converting the project name to lower case. But for
vue create ., we cannot change the current folder's name. So, we'll
have another edge case to test (projectName != folderName).

What kind of change does this PR introduce? (check at least one)

  • Bugfix
  • Feature
  • Code style update
  • Refactor
  • Docs
  • Underlying tools
  • Other, please describe:

Does this PR introduce a breaking change? (check one)

  • Yes
  • No

Other information:

closes vuejs#2547
closes vuejs#5032

I'm still very hesitant on adding this feature, though.

First, this change allows project creation in a folder with uppercase
letters in its name. It is strongly discouraged and may cause many
weird issues all over the ecosystem.

For example, vuejs#5022, vuejs#4424, vuejs#3665, vuejs#4174#issuecomment-569709494 are all
caused by case issues. Adding support for uppercase project names will
only worsen this situation.

Secondly, it adds a lot of maintenance burden to us. As noted in the
comments, these prompts are hard to test right now (because
`createTestProject` runs in another process so it's hard to intercept
the prompts). Even if such test utilities are added in the future, it's
still very tedious to take care of all the case issues in the test
suite.

What's worse is that we can affect the project folders created by
@vue/cli by converting the project name to lower case. But for
`vue create .`, we cannot change the current folder's name. So, we'll
have another edge case to test.
@haoqunjiang
Copy link
Member Author

Another issue caused by uppercase letters is #4251
It's because though Vue CLI UI already converts project names to uppercase, it does not convert targetDir along with that.

const targetDir = path.join(cwd.get(), input.folder)

It's easily fixable but it's an example of how many edge cases there could have been if we supported uppercase project names.

@pksunkara
Copy link
Contributor

I wouldn't actually allow the uppercase situation at all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants