Skip to content
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

Merged
merged 1 commit into from
Jul 13, 2020

Conversation

sebinsua
Copy link
Contributor

No description provided.


// todo - read from meta.json inside these folders and filter out those which aren't ready to be published yet
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@sebinsua sebinsua requested a review from threepointone July 13, 2020 14:10
@@ -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),
Copy link
Contributor Author

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",
Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

@threepointone threepointone left a 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",
Copy link
Contributor

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
Copy link
Contributor

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.

@sebinsua sebinsua merged commit 27b20a7 into master Jul 13, 2020
@sebinsua sebinsua deleted the use-package-names branch July 13, 2020 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants