loopback-next icon indicating copy to clipboard operation
loopback-next copied to clipboard

[CLI] `lb4` does not create app with uppercase letters

Open hacksparrow opened this issue 8 years ago • 10 comments

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

hacksparrow avatar Aug 31 '18 13:08 hacksparrow

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 avatar Aug 31 '18 18:08 raymondfeng

@raymondfeng can I implement an extra option for npm package name in the generator as this seems the right implementation.

vvdwivedi avatar Dec 03 '18 09:12 vvdwivedi

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.

bajtos avatar Jun 20 '19 13:06 bajtos

Sure, will start a PR soon.

vvdwivedi avatar Jun 21 '19 09:06 vvdwivedi

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 avatar Dec 24 '19 23:12 javiersantossanchez

@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.

vvdwivedi avatar Dec 25 '19 05:12 vvdwivedi

@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.

bajtos avatar Mar 06 '20 14:03 bajtos

Hello, @bajtos Yes I would happy to work on this task. Then I going to start to work on it tomorrow.

javiersantossanchez avatar Mar 06 '20 20:03 javiersantossanchez

@javiersantossanchez ping 😄 Have you managed to make any progress? Is there anything you need help with?

bajtos avatar Apr 30 '20 14:04 bajtos

Hi, @bajtos
A long time ago we talk about this issue. And I finally submit the change.

javiersantossanchez avatar Oct 10 '20 16:10 javiersantossanchez