ui5-community / generator-ui5-project

Generator for UI5-based web-apps which use the official UI5 tooling and support multiple deployment targets such as the SAP Business Technology Platform
Apache License 2.0
44 stars 27 forks source link

QoL change: projectname ↔ "name" attribute in package.json #44

Closed wridgeu closed 2 months ago

wridgeu commented 2 years ago

Hey everyone,

I've come to notice that we're using the projectname from the prompt as name within the package.json. This doesn't fit a 100% though.

image

I'm not sure if there are any restrictions on the UI5 projectname (i.e. myUI5App, used as default), at least I haven't come across any so far. I do feel like the common way of naming such projects is all lowercase ("myapp") or sometimes with hyphenation ("my-app").

ideas

Would it make sense to either restrict/adjust the way projectnames can be given during the prompt?

https://github.com/ui5-community/generator-ui5-project/blob/4c2e1930a91d03eef728faabe5567f8fd410d4ee/generators/app/index.js#L17-L28

... or would it make more sense to maybe match the RegEx / or just put it all lowercase in the package.json creation?

https://github.com/ui5-community/generator-ui5-project/blob/4c2e1930a91d03eef728faabe5567f8fd410d4ee/generators/app/index.js#L152-L154

infos

name attribute of package.json: https://docs.npmjs.com/creating-a-package-json-file#required-name-and-version-fields

feedback

Would you even consider this being nice to have or do you see this from different PoVs like "just name it properly", "just rename it in package.json later on" or something like that?

nicoschoenteich commented 2 months ago

I'd default to "just name it properly" and let the user decide. Currently we only restrict the project name (and also uimodule name) in a way so that the generator doesn't break. TBH I don't really care whether camel case is used or not - I wouldn't want to interfere with some other guideline or conventions people have in their teams 😅

No one seems to have jumped on this in 2 years, so I will go ahead and close it. Thanks for bringing it up tho.

wridgeu commented 2 months ago

Totally forgot that I even created that. 2 years later ... yeah, I agree with you. :)