-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Description
Introduce name
property in customTemplate
to even enhances the customTemplate
feature where the user need to have separate component TemplateName and the only purpose of the TemplateName component is to provide templates which takes up space.
So the name property provides the user with two option dynamic and user defined name.
-
dynamic
- this takes the component name from the template path provided in config and replaces it with the name provided while generation.For example:
{ "customTemplate": { "name": "dynamic", "component": "../HeroAction.tsx", "style": "../HeroAction.css", "test": "../HeroAction.test.tsx", "story": "../HeroAction.stories.tsx" } }
Note: Here the component name used in the templates is
HeroAction
based on the general practice of naming the component file the same as component function, soHeroAction
will be replaced with name provided while generation. -
Custom Name - this can be used when your project doesn't follow the practice of naming the component file the same as component function. So the component name provided for name property will be replaced with the component name provided in the generation.
For example:
{ "customTemplate": { "name": "Hero", "component": "../HeroAction.tsx", "style": "../HeroAction.css", "test": "../HeroAction.test.tsx", "story": "../HeroAction.stories.tsx" } }
Here the
HeroAction.tsx
file will have component function namedHero
, so component nameHero
will be replaced by the component name provided while generation.
Suggested solution
This can be achieved by introducing name
property in customTemplate
Alternative
No response
Additional context
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that request the same feature to avoid creating a duplicate.