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

Change all spaces for "-" in default package name #82

wants to merge 1 commit into
base: latest


Copy link

commented Mar 10, 2019

Hi npm! I've improved the default package name you get from npm init by making sure to remove all the spaces and also formatting the name when the yes option is used. I've also added some tests to test the default name formatting. That's the gist of it so if you are in a rush, no need to read any further!

Edit: As soon as I submitted this, I realized that there are already pull requests open to make these changes. If you rather go with those instead I could change this to just add the tests.

Some context in case you've got some extra time: I teach a Web development course to beginners and of course we use npm a ton. It's pretty common when learning about npm init that they create folders with spaces and uppercase letters in the name. It used to be extra friction when the default package name given by npm init wouldn't work. Thanks for fixing most of those problems already!

With these changes, small as they may be, it should be a lot less painful for beginners to get started with npm.

Change all spaces for "-" in default package name
- Replace all spaces instead of the just the first space.
- Format name even when using "yes" option
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.