-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cli): add resource generating invalid react component name (#6226)
Co-authored-by: Ali Emir Şen <[email protected]>
- Loading branch information
1 parent
4e37590
commit 9806a36
Showing
14 changed files
with
148 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
--- | ||
"@refinedev/cli": patch | ||
--- | ||
|
||
fix: `refine add resource` generating invalid React component name. #6225 | ||
|
||
`refine add resource blog-posts` command was generating invalid React component name when the resource name contains a hyphen. This issue has been fixed by converting the resource name to PascalCase before generating the React component name. | ||
|
||
```diff | ||
- export const Blog-PostsList: React.FC = () => {}; | ||
+ export const BlogPostsList: React.FC = () => {}; | ||
``` | ||
|
||
[Resolves #6225](https://github.com/refinedev/refine/issues/6225) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
packages/cli/templates/resource/pages/next/create/page.tsx.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { {{capitalize resource}}Create } from "@components/{{resourceFolderName}}"; | ||
import { {{getComponentNameByResource resource}}Create } from "@components/{{resourceFolderName}}"; | ||
|
||
export default function {{capitalize resource}}CreatePage() { | ||
return <{{capitalize resource}}Create />; | ||
export default function {{getComponentNameByResource resource}}CreatePage() { | ||
return <{{getComponentNameByResource resource}}Create />; | ||
}; |
6 changes: 3 additions & 3 deletions
6
packages/cli/templates/resource/pages/next/edit/[id]/page.tsx.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { {{capitalize resource}}Edit } from "@components/{{resourceFolderName}}"; | ||
import { {{getComponentNameByResource resource}}Edit } from "@components/{{resourceFolderName}}"; | ||
|
||
export default function {{capitalize resource}}EditPage() { | ||
return <{{capitalize resource}}Edit />; | ||
export default function {{getComponentNameByResource resource}}EditPage() { | ||
return <{{getComponentNameByResource resource}}Edit />; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { {{capitalize resource}}List } from "@components/{{resourceFolderName}}"; | ||
import { {{getComponentNameByResource resource}}List } from "@components/{{resourceFolderName}}"; | ||
|
||
export default function {{capitalize resource}}ListPage() { | ||
return <{{capitalize resource}}List />; | ||
export default function {{getComponentNameByResource resource}}ListPage() { | ||
return <{{getComponentNameByResource resource}}List />; | ||
}; |
6 changes: 3 additions & 3 deletions
6
packages/cli/templates/resource/pages/next/show/[id]/page.tsx.hbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { {{capitalize resource}}Show } from "@components/{{resourceFolderName}}"; | ||
import { {{getComponentNameByResource resource}}Show } from "@components/{{resourceFolderName}}"; | ||
|
||
export default function {{capitalize resource}}ShowPage() { | ||
return <{{capitalize resource}}Show />; | ||
export default function {{getComponentNameByResource resource}}ShowPage() { | ||
return <{{getComponentNameByResource resource}}Show />; | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.