Skip to content

Commit

Permalink
Merge pull request #10 from kadirahq/update-version
Browse files Browse the repository at this point in the history
Update the readme and version
  • Loading branch information
madushan1000 committed Oct 20, 2016
2 parents 573bb72 + ebd871f commit 409b3d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Add propType doc to react classes
## Installation

```sh
$ npm install @kadira/babel-plugin-react-docgen
$ npm install babel-plugin-react-docgen
```

## Usage
Expand All @@ -16,26 +16,29 @@ $ npm install @kadira/babel-plugin-react-docgen

```json
{
"plugins": ["@kadira/babel-plugin-react-docgen"]
"plugins": ["babel-plugin-react-docgen"]
}
```

### Via CLI

```sh
$ babel --plugins @kadira/babel-plugin-react-docgen script.js
$ babel --plugins babel-plugin-react-docgen script.js
```

### Via Node API

```javascript
require("babel-core").transform("code", {
plugins: ["@kadira/babel-plugin-react-docgen"]
plugins: ["babel-plugin-react-docgen"]
});
```

## Guide

* React class information is avalable via `<ClassName>.__docgenInfo` as a JSON parsabel string.
* This plugin uses `react-docgen` under the hood, so every [limitation](https://github.com/reactjs/react-docgen#guidelines-for-default-resolvers-and-handlers) it has, applies.
* Only works classes extended from `React.Component` with a `render()` method. `React.createClass` and stateless components are not supported yet.
* If you need a global object with all the react component docs, set plugin options like this in `.babelrc` (replace <your global name> with variable name you want)
```
"plugins":[["babel-plugin-react-docgen", {"DOC_GEN_GLOBAL": "<your global name>"}]]
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.1.0",
"version": "1.2.0",
"name": "@kadira/babel-plugin-react-docgen",
"description": "Add propType doc to react classes",
"repository": "https://github.com/kadirahq/babel-plugin-react-docgen",
Expand Down

0 comments on commit 409b3d8

Please sign in to comment.