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

Feature Request: Allow generating kebab-case projects #1391

Closed
derekgreenberg opened this issue Mar 9, 2019 · 4 comments · Fixed by #2534
Closed

Feature Request: Allow generating kebab-case projects #1391

derekgreenberg opened this issue Mar 9, 2019 · 4 comments · Fixed by #2534

Comments

@derekgreenberg
Copy link
Member


What's going on?
This is more of a feature request than an issue report. Ignite new requires an app name to be provided in camel case. For example: Please use camel case for your project name. Ex: FooBar. This generates a containing directory using the same project name, such as FooBar

For some users, it would be preferable to generate the containing directory in kebab case, such as 'foo-bar'. Furthermore, when generating a new app, the name of the package (i.e. the name prop in package.json) is generated in camel case, and Prettier gripes about the format: String does not match the pattern of "^(?:@[a-z0-9-~][a-z0-9-._~]*/)?[a-z0-9-~][a-z0-9-._~]*$".

To summarize, this is a request for an option for the user to have the Ignited app directory name in kebab case and to have the package name prop is kebab case as well.


Steps to reproduce

  • Ignite a new project: ignite new FooBar
  • Observe that the project directory name is FooBar. That's expected, but it would be great if the user could provide an option so the project directory name was in kebab case: foo-bar
  • Observe the "name" prop in package.json. It is FooBar. That's expected, but it would be nice if the package name was in kebab case. At the very least, how about if the user could provide a kebab case option to Ignite so the package name was generated in kebab case?

ignite doctor results:

System
  platform           darwin
  arch               x64
  cpu                8 cores                                              Intel(R) Core(TM) i7-4980HQ CPU @ 2.80GHz
  directory          /Users/derekgreenberg/Documents/ignite-experiments

JavaScript
  node               8.10.0       /usr/local/bin/node
  npm                5.6.0        /usr/local/bin/npm
  yarn               1.10.1       /usr/local/bin/yarn

React Native
  react-native-cli   2.0.1

Ignite
  ignite             2.2.3        /usr/local/bin/ignite

Android
  java               1.8.0_73     /Library/Java/JavaVirtualMachines/jdk1.8.0_73.jdk/Contents/Home/bin/java
  android home       -            /usr/local/opt/android-sdk

iOS
  xcode              10.1
@kevinvangelder
Copy link
Member

kevinvangelder commented Mar 9, 2019

React Native will not permit a project to be generated with kebab case, I presume because it would cause problems in the native code. Are you suggesting that it only apply to the package.json and that we would automatically convert the project name to CamelCase before running the RN generator?

@kevinvangelder kevinvangelder changed the title Ignite new camel case - option for kebab case feature request Feature Request: Allow generating kebab-case projects Mar 9, 2019
@derekgreenberg
Copy link
Member Author

derekgreenberg commented Mar 9, 2019

@kevinvangelder I'm suggesting:

  • We stick to the existing rule that the user must provide the project name in camel case as we do now
  • We add an option (--kebab-case, -k, or similar) to rewrite the generated containing directory in kebab case. The app itself would be generated as usual using the camel case name that the user passed in. So, for example, if the user ignited "FooBar", the containing directory would be renamed as "foo-bar"
  • We would apply the kebab case transform to the name prop in package.json. I have experimented with this and it appears that you can modify the name prop in package.json after ignite has generated the project. Example procedure: (a) ignite new FooBar (b) after ignite is done, modify the package.json name prop from "Foobar" to "foo-bar" (c) CD to the FooBar directory (d) run yarn to install dependencies (e) run react-native run-ios. It works!

@jamonholmgren
Copy link
Member

@derekgreenberg I support this, good idea. I'm not sure if an option is the right way to go or if it's better to just do ignite new foo-bar and have the app name inferred from the folder name given.

This is likely to be somewhat nontrivial, though, because of how we are making assumptions throughout the spin-up process. The workaround is to generate the new project and then simply rename the main folder after the fact.

@frankcalise
Copy link
Contributor

This feature was added to v9 in #2446

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

Successfully merging a pull request may close this issue.

4 participants