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

introduce -exact flag in the create-api command #287

Closed
krunalsshah opened this issue Nov 3, 2017 · 3 comments
Closed

introduce -exact flag in the create-api command #287

krunalsshah opened this issue Nov 3, 2017 · 3 comments

Comments

@krunalsshah
Copy link
Contributor

currently the create-api appends react-native-.+-api to the apiName. instead it would be nicer to have to exact flag
Problem : ern create-api my-api results in react-native-my-api-api
Enhancement : using exact flag it could just be generated as package my-api

@belemaire @deepueg thoughts?

@belemaire
Copy link
Member

@krunalsshah

The API name provided by the user to create-api command should be the name that is used (and added in the ern package.json object as moduleName). This is the same experience as create-miniapp.

The problem I see here and that we discussed, is that if I specify the name WeatherApi, then the prompted package name suggestion will be weather-api-api which is ... bad.

That being said, this is the right name ... because it's more intuitive and looks better to call in Android or iOS or JS WeatherApi.requests. ... rather than Weather.requests. ....

Two things I would suggest here :

  1. If the module name that the user provide to command, is not suffixed by Api, suggest the user to suffix the Api through a prompt.

i.e, something like

$ ern create-api Weather
> To follow naming conventions we suggest suffixing the name of your API with Api
> Do you want to name the Api as WeatherApi rather than Weather ? Y/n

If the module name provided by the user is already suffixed by Api, then do not prompt.

  1. If the module name that the user provide (or modified by prompt) is suffixed by Api, do not add -api suffix for package name to avoid -api-api crap.

Does it makes sense ?

@belemaire
Copy link
Member

@krunalsshah

BTW for point 2. the same should be applied for create-miniapp and create-api-impl

Just re-did the Getting Started guide and when I ran ern create-miniapp MovieListMiniApp it propose a package name as : movie-list-mini-app-miniapp :(

So let's make point 2. a specific issue.

We should create an issue for point 2. (Do not add module suffix in name if already present) covering create-miniapp, create-api and create-api-impl and create another issue for point 1. covering create-miniapp, create-api and create-api-impl as well.

@krunalsshah
Copy link
Contributor Author

@belemaire thanks
Issues created
#315
#316

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

No branches or pull requests

2 participants