Skip to content

oct-cr/react-doc-creator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Create documentation for your React projects in an easy way using standard PropTypes declarations.

Share the documentation in your project's repository.

Demo

It parses the files using React Docgen. Please refer to its documentation for details.

Installation

$ npm install --save-dev react-doc-creator

Usage

In your package.json insert:

{
  // ...
  "scripts": {
    "build:doc": "react-doc-creator"
  }
  // ...
}

To run it:

$ npm run build:doc

It will search for React Components in your src folder and write the documentation in a COMPONENTS.md file

Options

react-doc-creator [path] ...[options]

  path     A component file or directory. Default: src

  Options:
    -o, --out <file>         Target markdown file. (default: COMPONENTS.md)
    -x, --extension <items>  Include only these file extensions. (default: js,jsx)
    -i, --ignore <items>     Folders to ignore. (default: node_modules,__tests__,__mocks__)
    -e, --exclude [regexp]   Filename pattern to exclude.
    -t, --title [value]      Document title. (default: React Components)

Use Examples

The options should be added to the corresponding react-doc-creator script in package.json.

Exclude specific file

react-doc-creator src --exclude demo\.jsx

Period (.) must be escaped since the exclude option works with RegExp.

Ignore directories

react-doc-creator src --ignore tests,utils

Warning: Avoid spaces between directory names.

Set custom title

react-doc-creator src --title 'Project shared components'