[CLI] `lb4` does not create app with uppercase letters
Description / Steps to reproduce / Feature proposal
$ lb4 myLB4app
> Generation is aborted: Invalid npm package name: myLB4app
This is likely due to the package.json's name format restriction. We should use the user-submitted name for everything (directory name etc.), except for the name property in package.json; for that, CLI should do the hyphenation and lowercasing for the user.
Thoughts?
Current Behavior
lb4 refuses to create an app if it contains uppercase letters.
Expected Behavior
Should allow creation of apps with uppercase and lowercase letters.
See Reporting Issues for more tips on writing good issues
Another option is to prompt the npm package name with a default value by convention if the name fails validation. The other use case is for scoped packages such as @myorg/mypkg.
@raymondfeng can I implement an extra option for npm package name in the generator as this seems the right implementation.
can I implement an extra option for npm package name in the generator as this seems the right implementation.
@vvdwivedi that's great! Let us know if you need any help along the way. See Contributing code and Submitting a pull request to LoopBack 4 to get you started.
Sure, will start a PR soon.
Hi everybody, I am looking for an open-source project to contribute, and I found this issue and I would like to work on it. This issue is unassigned I just want to validate there is nobody working on it.
I was reviewing the source code and I found that utils.js is using validate-npm-package-name package from npm repository validate-npm-package-name. the validate allows lowercase characters only on the packages name.
Then I have a question, the lb4 command must allow the user to create packages with uppercase letters??
@javiersantossanchez I was supposed to work on this, but stuck with something else. I am not sure I understand your second question correctly, but if you want to know: if users should be able to create packages with uppercase letters?
Then npm doesn't allow Capital letters anymore in the package name.
@javiersantossanchez sorry for responding so late. Are you still keen to work on this issue?
Based on the previous discussion, I think the agreement is to add a new prompt for the npm package name. This prompt should use a lower-case version of the project name as the default value offered by CLI to the user running it, and we can use validate-npm-package-name to ensure the prompt is answered with a valid package name.
Hello, @bajtos Yes I would happy to work on this task. Then I going to start to work on it tomorrow.
@javiersantossanchez ping 😄 Have you managed to make any progress? Is there anything you need help with?
Hi, @bajtos
A long time ago we talk about this issue. And I finally submit the change.