Skip to content

sebkolind/react-component-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

23 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

React Create Component CLI

A CLI tool to generate React components with ease.

Installation

This will install the CLI tool globally under the name rcc.

deno install -A -n rcc jsr:@sebkolind/react-component-cli

Usage

rcc <component-name>/<sub-component-name> [/<sub-component-name> ...]

Arguments

  • 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

Example

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

Configuration

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.

Default Configuration

mainFile:
  path: ""
  prefix: ""
  extension: ".tsx"
  caseFormat: "PascalCase"
styleFile:
  path: ""
  prefix: ""
  extension: ".module.scss"
  nameFromComponent: true
barrelFiles:
  extension: ".ts"
structure: "nested"

About

๐Ÿš€ A CLI tool to generate React components with ease.

Resources

Stars

Watchers

Forks