11# React Codegen CLI
22
33React Codegen is a development tool to quickly generate React components.
4- It helps you to speed up productivity in React projects and stop copying, pasting files
4+ It helps you to speed up productivity in React projects and stop copying, pasting files.
55
66## Installation
77
@@ -22,8 +22,8 @@ Then add the following script to your `packages.json` file:
2222
2323## Get started
2424
25- ` react-codegen ` will look for a [ configuration file] ( #configration -file ) in root folder and use it if available.
26- If no config file is found it will fallback to a default configuration.
25+ ` react-codegen ` will look for a [ configuration file] ( #configuration -file ) in root folder and use it if available.
26+ If no config file found it will fallback to a default configuration.
2727
2828The following command can be used to generate code:
2929``` sh
@@ -32,14 +32,20 @@ npm run react-codegen
3232
3333After running the command in the terminal,
3434you can enter the name of the component and configure the generation of the files.
35- When creating a react component, you are given the choice to modificate the component parts,
35+ When creating a React component, you are given the choice to modify the component parts,
3636such as connecting the ` useState ` , ` useEffect ` , ` propTypes ` and so on.
3737
3838![ Demo] ( https://i.imgur.com/MVFvUq5.png )
3939
40- ## Configration file
40+ ## Configuration file
4141
42- Use ` JSON ` file to specify configuration information. This should be in the form of ` react-codegen.json ` .
42+ React codegen uses [ cosmiconfig] ( https://github.com/davidtheclark/cosmiconfig ) for configuration file support. This means you can configure it via:
43+
44+ - A ` "react-codegen" ` key in your ` package.json ` file.
45+ - A ` .react-codegenrc ` file, written in JSON or YAML, with optional extensions: ` .json/.yaml/.yml ` (without extension takes precedence).
46+ - A ` .react-codegenrc.js ` or ` react-codegen.config.js ` file that exports an object.
47+
48+ The configuration file will be resolved in the root folder of the project. If no configuration file found the default config will be used.
4349
4450| Type | Value | Default | Description |
4551| :------------:| :------------------------------------------------------------:| :--------------:| ----------------------------------------------------------------------|
0 commit comments