1.0.1 • Published 3 years ago
create-basic-react-component v1.0.1
create-basic-react-component
A CLI to create all the necessary files to build a react components.
Install
npm i -g create-basic-react-componentUsage
create-basic-rc <component name> [options]
Options:
-h, --help display help for command
-V, --version output the current version
-s, --styles [extension] component module styles extension. [default: css]
-p, --path [directory] directory path to create component. [default: current working directory]
-ts, --typescript define component with or without typescript. [default: without typescript]Example
Default options
Run the below command with the component name
create-basic-rc Buttonand basic react componenent will be created with all required files. If the options are not provided it will fallback to default option.
Here is the structure of the component folder
Button
├── Button.jsx
├── Button.test.js
├── Button.module.css
└── Button.stories.jsxStyles option
create-basic-rc Button -s scss or create-basic-rc Button --styles scsswill create styles with the scss
Button
├── Button.jsx
├── Button.test.js
├── Button.module.scss
└── Button.stories.jsxTypescript option
create-basic-rc Button -ts or create-basic-rc Button --typescriptwill create react components with typescript
Button
├── Button.tsx
├── Button.test.js
├── Button.module.css
└── Button.stories.tsxFolder path option
create-basic-rc Button -p src/components or create-basic-rc Button --path src/componentswill create the react components in the specified folder
src
└──components
└──Button
├── Button.tsx
├── Button.test.js
├── Button.module.css
└── Button.stories.tsxTools used
- commander
- chalk