0.2.3 • Published 8 years ago

reactjs-init v0.2.3

Weekly downloads
3
License
-
Repository
github
Last release
8 years ago

reactjs-init 中文版

A command line tool that generates a React.js project boilerplate.

Getting Started

$ npm install -g reactjs-init

Commands

Generate a boilerplate.

$ reactjs new react-demo

THEN

$ cd react-demo

$ npm install

$ npm run start

# Enjoy it !

The project will have the following directory structure:

react-demo/
  src/
    components/
      App/
        App.jsx
        style.less
        index.jsx
    index.html
    index.jsx
    style.less
  .babrlrc
  .eslintrc
  .eslintignore
  .gitignore
  package.json
  webpack.config.js
  webpack.prd.config.js
  README.md

Generate a React component.

$ reactjs generate MyComponent

This command will creates a directory MyComponent inside your src/components directory.

This component will have the following directory structure:

MyCompnent/
  MyCompnent.js
  style.less
  index.js

Component Lifecycle methods

By default, the component will be included React lifecyle methods(eg: componentWillMount/componentWillUpdate...), but you can not generate these lifecyle methods by passing an option -s with the command.

eg:

$ reactjs generate -s MyComponent

Property Types

Currently supported property types:

Optional PropsRequired Props
anyrequiredAny
arrayrequiredArray
boolrequiredBool
funcrequiredFunc
numberrequiredNumber
objectrequiredObject
stringrequiredString

You can add some propTypes with the component, command just like following this:

$ reactjs generate MyComponent componentPropA:any componentPropB:bool

Usage

$ reactjs --help

  Usage: reactjs <command> [options]


  Commands:

    new <name>
    Generate a new React.js boilerplate project.

    generate [options] <Component> [propName:PropType...]
    Generate a new react component.


  Options:

    -h, --help     output usage information
    -V, --version  output the version number

License

the MIT license.

0.2.3

8 years ago

0.2.2

8 years ago

0.2.1

8 years ago

0.2.0

8 years ago

0.1.0

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago