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

Spaces in project names are not handled properly #1649

Closed
wojtekmaj opened this issue Feb 26, 2017 · 4 comments
Closed

Spaces in project names are not handled properly #1649

wojtekmaj opened this issue Feb 26, 2017 · 4 comments
Milestone

Comments

@wojtekmaj
Copy link

Description

create-react-app allows you to create an app with spaces (and uppercase letters). Simply fire create-react-app "Example project" and it will be created! This, however, creates some issues stated below.

Expected behavior

  • create-react-app should disallow creating apps with spaces and uppercase letters

OR

  • create-react-app should detect if there are spaces/uppercase letters in project name provided by the user and:
    • Success message after creating an app should wrap project name in quotes if necessary
    • Project name in package.json should have spaces changed to dashes to avoid npm error

Actual behavior

After the app is created using the command above, a help message is displayed suggesting to go to the folder created by create-react app (sorry, don't remember it word-by word):

> App created successfully (...)
> Run the following command:
> cd **{project_name_here}**

Obviously, running command like cd ./My project won't work (we need to use command like cd "./My project").

Furthermore, running the app fails as the name containing spaces is also inserted into package.json file, and npm throws an error.

@Timer
Copy link
Contributor

Timer commented Feb 26, 2017

Nice catch! We would greatly appreciate if you could pull together a PR fixing this.
I believe I like the section option more, automatically replacing spaces with dashes and lowercasing.

@gaearon
Copy link
Contributor

gaearon commented Feb 26, 2017

We should probably replace all unsafe characters and not just spaces.

@johann-sonntagbauer
Copy link
Contributor

Its kinda tricky to provide a generic escaping mechanism because the project name has some requirements to be met. Maybe a simple validation step based on https://github.com/npm/validate-npm-package-name during creation is sufficient enough.

@gaearon
Copy link
Contributor

gaearon commented Feb 28, 2017

Fixed by #1662.

@gaearon gaearon closed this as completed Feb 28, 2017
@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants