@99xt/react-cli 中文文档教程
react-cli
react-cli 是一个命令行界面,可为 React 开发人员带来流畅的开发人员体验 (DX)。 react-cli 提供了一种更好的方法来生成带有 react-boilerplate 的 React 项目。 使用此工具,可以在项目启动后继续生成具有大量自定义的样板代码。
Install
$ npm install -g @99xt/react-cli
Usage
react init [name]
别名:i
name
项目名称。
Options
-l
Add eslint configuration.
react generate component [module] [component]
别名:g
module
反应组件应该放置在其中的模块名称。 (组件目录中的子目录)
component
React 组件名称。
react generate test [module] [component]
别名:g
创建 React 组件。
module
应放置测试文件的模块名称。 (tests 目录中的子目录)
component
测试文件名。
react view -c -t
alias: v
查看 React 组件和测试文件。
Options
<代码>-c 查看 React 组件文件目录。
<代码>-t 查看测试文件目录。
react config [key] [value]
别名:c
更改 .reactclirc
中的配置。
key
配置键 示例:client
value
配置值 示例:src
(源目录)
Configuring existing projects
要在现有 React 项目中使用 react-cli,请导航到创建 React 组件的目录。 创建 react-cli 配置文件,.reactclirc
(类似于 .babelrc
)。 在键值对中添加配置。
{
"client": "src"
}
这指定 React 组件放置在 src/components
目录中。
Features
- Initiate React projects
- Create React components
- Create test files
- Interactive view of the component structure
References
- What is scaffolding ?
- What is a CLI ?
- Why good UX in CLIs matters
- Projects with similar objectives
- Yeoman
Contributor guidelines
- Fork the repository.
- Clone the forked repository.
- Create your own branch.
- Create tests and make sure tests pass on travis.
- Create a pull request with changes made.
有关详细信息,请参阅 CONTRIBUTING.md
License
MIT © 99XT
react-cli
Scaffolding tool for React
react-cli is a command line interface which brings smooth developer experience (DX) for React devs. react-cli provides a better way to generate react projects with react-boilerplate. With this tool it's possible to continue generating boilerplate code with heavy customizations once a project is initiated.
Install
$ npm install -g @99xt/react-cli
Usage
react init [name]
alias: i
name
Project name.
Options
-l
Add eslint configuration.
react generate component [module] [component]
alias: g
module
Module name where the react component should be placed within. (Subdirectory within components directory)
component
React component name.
react generate test [module] [component]
alias: g
Create React component.
module
Module name where the test file should be placed within. (Subdirectory within tests directory)
component
Test file name.
react view -c -t
alias: v
View react components and test files.
Options
-c
View React components file directory.-t
View tests file directory.
react config [key] [value]
alias: c
Change configuration in .reactclirc
.
key
Key for configuration example: client
value
Value for configuration example: src
(source directory)
Configuring existing projects
To use react-cli in existing React project navigate to directory where React components are created. Create react-cli configuration file, .reactclirc
(similar to .babelrc
). Add configuration in key value pairs.
{
"client": "src"
}
This specifies that React components are placed in src/components
directory.
Features
- Initiate React projects
- Create React components
- Create test files
- Interactive view of the component structure
References
- What is scaffolding ?
- What is a CLI ?
- Why good UX in CLIs matters
- Projects with similar objectives
- Yeoman
Contributor guidelines
- Fork the repository.
- Clone the forked repository.
- Create your own branch.
- Create tests and make sure tests pass on travis.
- Create a pull request with changes made.
For more information refer CONTRIBUTING.md
License
MIT © 99XT