Templates
Describe your component folder and us
Last updated
Describe your component folder and us
Last updated
Template is an object to describe your component folder structure.
File has next possible fields:
Just basic example of component structure:
This field describes how to generate component file name.
Examples:
index.ts
[name].tsx
[name].module.css
__tests__/[name].test.tsx
This field allows you to specify special folder for this kind of templates. If you need generate new api file - you can set this field as /api
and this components will be generated to this folder automatically.
Field file
describes template file name. It can be just file name inside templates folder like stories.tmp
.
Also, it can be an array of files:
In case of array, user of this template will be asked on generation step
This field is boolean. By default all files is required. If you have optional files - you will be asked about them when you will create new component with the template. These files could be added on update mode.
This field is boolean. By default all optional files will be skipped, but you set them as false with option to unmark them during generation.
If you need to generate something else, not components only, you are able to set up array of templates.