Component generator

Main Trecli feature is component generator.

Generator command#

To generate component run default command:

trecli <ComponentName>

or use full command

trecli component <ComponentName>

or use alias

trecli c <ComponentName>

Generator options#

Trecli ships with a handful of customizable options, usable in both the CLI and configuration file.

Index File Generation#

Specify if component contain index.ts file.

DefaultCLI optionCLI aliasConfiguration file
false--index--idxindex: <boolean>

Styles Solutions#

Valid options:

DefaultCLI optionCLI aliasConfiguration file
false--styles=<"css"∣"css-modules"∣"material-ui">-sstyles: <"css"∣"css-modules"∣"material-ui"∣false>
note

If you have styles value specified in your configuration file you can still generate component without style by adding --no-styles or --no-s option to command.


Lazy Loaded#

Specify if component will be exporting named of default export. Default export is necessary if you are going to import component with React.lazy.

DefaultCLI optionCLI aliasConfiguration file
false--lazy-loaded-llazyLoaded: <boolean>

More information about React.lazy and exports is available in official react documentation