Frontmatter
| title | feat(build): allow create-class to drop classes into cwd |
| author | ThorstenSuckow |
| state | Merged |
| createdAt | Jun 24, 2022, 3:19 PM |
| updatedAt | Jul 11, 2022, 6:39 PM |
| closedAt | Jun 25, 2022, 11:13 AM |
| mergedAt | Jun 25, 2022, 11:13 AM |
| branches | dev ← dev |
| url | https://github.com/neomjs/neo/pull/3193 |
Merged

tobiu
commented on Jun 25, 2022, 11:13 AM
Hi @ThorstenSuckow, of course i will accept the PR :)
Just 2 comments:
- I don't think we should add a license on a "per file" basis. We have the
LICENSEfile on the top level of the repo, which github and npm recognises. Adding it inside every file would increase the repo-size quite a bit and if we want to change the wording a little bit at some point, it would be quite some effort. We could create a new ticket to discuss about it though. - App namespaces are most likely written in PascalCase. E.g.
acmewould probably beAcMeor something similar. Since the folder name of an app does not need to know about uppercase letters, there are 2 files: https://github.com/neomjs/neo/blob/dev/buildScripts/webpack/json/myApps.template.json and a version without the.templateas soon as you create a new app. this file also exist inside the workspace scope. As a follow-up ticket, we should parse the file(s) and adjust the class names accordingly.

ThorstenSuckow
commented on Jun 25, 2022, 5:30 PM
- I don't think we should add a license on a "per file" basis. We have the
LICENSEfile on the top level of the repo, which github and npm recognises. Adding it inside every file would increase the repo-size quite a bit and if we want to change the wording a little bit at some point, it would be quite some effort. We could create a new ticket to discuss about it though.
ACK.
- App namespaces are most likely written in PascalCase. E.g.
acmewould probably beAcMeor something similar. Since the folder name of an app does not need to know about uppercase letters, there are 2 files: https://github.com/neomjs/neo/blob/dev/buildScripts/webpack/json/myApps.template.json and a version without the.templateas soon as you create a new app. this file also exist inside the workspace scope. As a follow-up ticket, we should parse the file(s) and adjust the class names accordingly.
I don't think I understand you correctly - how does this affect the proposed changes?
Also, the usage of PascalCase instead of camelCase in namespace parts worries me since I'm not used to it ;) , but I will create a discussion out of it.

Dinkh
commented on Jul 11, 2022, 6:38 PM
I am in for PascalCase ;) The app folder is lowercase. The NameSpace is PascalCase.
create-classcreates class files in current working directoryThis PR introduces several new enhancements to the
create-classscript:-d-dis used:-snpx neo-cc(test w/npm i -gfor repository clones)Changes
The original implementation remains unchanged regarding functionality, some lines had to be shifted and re-arranged into conditional statements given the new option the script provides. It was also necessary to distinguish between - and further reuse - the original
cwd- and__dirname-variables, so the script can now be run outside of theneo-folder.Features
-dOptionThe
-doptions stands fordropand advises the script to run in a none-interactive environment. It will compute the namespace based on the current working directory up to the directory that is either used from the value found in the script'ssourceRootDirs-array, or specified with the-s-option.Example:
The user has an application in
/neo/apps/acmeand wants to create a new class foracme.view.masterDetail.TableView.cd /neo/apps/acme/view/masterDetail npx neo-cc -c TableView -b component.Base -dresults in a file
TableView.mjscreated at/neo/apps/acme/view/masterDetailwith the following contents:import Base from '../../../../src/component/Base.mjs'; /** * @class acme.view.masterDetail.TableView * @extends Neo.component.Base */ class TableView extends Base { static getConfig() {return { /* * @member {String} className='acme.view.masterDetail.TableView' * @protected */ className: 'acme.view.masterDetail.TableView', /* * @member {Object} _vdom */ _vdom: {} }} } Neo.applyClassConfig(TableView); export default TableView;Note, that
appsis by default mentioned in thesourcesRootDirof the script. The user can overwrite the directory where the sources (and therefore top-level namespaces reside) by using the -s option:Example:
The user has an application in
/neo/FOLDER/acmeand wants to create a new class foracme.view.masterDetail.TableView.cd /neo/FOLDER/acme/view/masterDetail npx neo-cc -c TableView -b component.Base -d -s FOLDERWhat kind of change does this PR introduce? (check at least one)
Does this PR introduce a breaking change? (check one)
If yes, please describe the impact and migration path for existing applications:
The PR fulfills these requirements:
devbranch, not themasterbranchfix #xxx[,#xxx], where "xxx" is the issue number)If adding a new feature, the PR's description includes: