📘Templates
Describe your component folder and us
Template is an object to describe your component folder structure.
File has next possible fields:
Overview
Just basic example of component structure:
Name
This field describes how to generate component file name.
Examples:
index.ts
[name].tsx
[name].module.css
__tests__/[name].test.tsx
FolderPath
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.
File
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
Optional
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.
Default
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.
Multi-template example
If you need to generate something else, not components only, you are able to set up array of templates.
Last updated