A CLI tool to generate React components with ease.
This will install the CLI tool globally under the name rcc
.
deno install -A -n rcc jsr:@sebkolind/react-component-cli
rcc <component-name>/<sub-component-name> [/<sub-component-name> ...]
barrels
(boolean): Generate barrel files for each component. Default:true
flat
(boolean): Generate files in a flat structure. Default:false
styles
(boolean): Generate style files for each component. Default:true
With the default configuration, which can be seen below, this command:
rcc MyComponent/MySubComponent
will generate the following files:
MyComponent.tsx
MyComponent.module.scss
MyComponent/index.ts
MyComponent/MySubComponent/MySubComponent.tsx
MyComponent/MySubComponent/MySubComponent.module.scss
MyComponent/MySubComponent/index.ts
Create a configuration file at ~/.config/@sebkolind/rcc/config.yml
to customize the
generated files.
More details about the configuration file can be found here.
mainFile:
path: ""
prefix: ""
extension: ".tsx"
caseFormat: "PascalCase"
styleFile:
path: ""
prefix: ""
extension: ".module.scss"
nameFromComponent: true
barrelFiles:
extension: ".ts"
structure: "nested"