-
Notifications
You must be signed in to change notification settings - Fork 67
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
Import with param-case package name instead of PascalCase component name #28
Conversation
|
||
// todo - read from meta.json inside these folders and filter out those which aren't ready to be published yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I decided to use package.name#private
. Let me know if re-use in this way is problematic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, let's do this.
@@ -210,7 +216,8 @@ function widget(name: string) { | |||
filePath, | |||
fs | |||
.readFileSync(filePath, 'utf8') | |||
.replace(/Component\$\$/g, toPascalCase(name)), | |||
.replace(/PackageName\$\$/g, newWidgetPackageName) | |||
.replace(/ComponentName\$\$/g, newWidgetComponentName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Basically, it's no longer Component$$
which is rewritten, but instead ComponentName$$
and PackageName$$
. This means we still get a sensible component name, but the package name is param-case
(kebab-case, dash-case, etc.)
@@ -16,11 +16,11 @@ | |||
"dependencies": { | |||
"@craco/craco": "^5.6.4", | |||
"chalk": "^4.1.0", | |||
"change-case": "^4.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pros: a single import; cons: more dependencies than necessary.
I could explicitly install each case if that's preferred?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it's just used once, and I doubt its code will change, I would literally copy paste the implementations of those two functions (and license) into the bottom of cli.ts. But, your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tentative stamp, lgtm. Thanks!
@@ -16,11 +16,11 @@ | |||
"dependencies": { | |||
"@craco/craco": "^5.6.4", | |||
"chalk": "^4.1.0", | |||
"change-case": "^4.1.1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
since it's just used once, and I doubt its code will change, I would literally copy paste the implementations of those two functions (and license) into the bottom of cli.ts. But, your call.
|
||
// todo - read from meta.json inside these folders and filter out those which aren't ready to be published yet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, let's do this.
No description provided.