# react-extract-component-meta

> Webpack plugin to extract React component metadata.

Latest version **0.2.1** (published 2017-03-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-extract-component-meta
pnpm add react-extract-component-meta
yarn add react-extract-component-meta
bun add react-extract-component-meta
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.1 |
| Published | 2017-03-09 |
| First published | 2017-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sunil Kumar |
| Maintainers | sun1l |
| Keywords | react, component, metadata, props, webpack, plugin |

## Links

- npm: https://www.npmjs.com/package/react-extract-component-meta
- Repository: https://github.com/sun1l/react-extract-component-meta
- Homepage: https://github.com/sun1l/react-extract-component-meta#readme
- Issues: https://github.com/sun1l/react-extract-component-meta/issues
- npm.io page: https://npm.io/package/react-extract-component-meta

## Dependencies (2)

- [recast](https://npm.io/package/recast.md) ^0.11.22
- [react-docgen](https://npm.io/package/react-docgen.md) ^2.13.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.2.1 (latest) — 2017-03-09
- 0.2.0 — 2017-03-09
- 0.1.6 — 2017-03-08
- 0.1.5 — 2017-03-08
- 0.1.4 — 2017-03-08
- 0.1.3 — 2017-03-08
- 0.1.2 — 2017-03-08
- 0.1.1 — 2017-03-08
- 0.1.0 — 2017-03-08
- 0.0.1 — 2017-02-27

## README

# React Extract Component Metadata
[![npm](https://img.shields.io/npm/v/react-extract-component-meta.svg)](https://www.npmjs.com/package/react-extract-component-meta)

`react-extract-component-meta` is a Webpack plugin to extract [React](https://github.com/facebook/react) component metadata. It generates a JSON file as output.

# Installation

Install the module directly from npm:

```
npm install --save-dev react-extract-component-meta
```

# Usage
Import the plugin in your webpack.config.js file and create a new instance.

```Javascript
const ReactExtractComponentMeta = require('react-extract-component-meta');

module.exports = {
    ...    
    plugins: [new ReactExtractComponentMeta()]
};
```
`react-extract-component-meta` accpets a config object which allows you to specify the pattern to match your react components as well as name of the output JSON file.

```Javascript
const ReactExtractComponentMeta = require('react-extract-component-meta');

module.exports = {
    ...    
    plugins: [new ReactExtractComponentMeta({
        'filter': /component/gi,
        'output': {
            'filename': 'components-meta.json'
        }
    })]
};
```

Sample JSON file output

```Javascript
{
    "MyComponent": {
        "name": "MyComponent",
        "description": "MyComponent description",
        "methods": [
            {
                "name": "someFuction",
                "docblock": "Component function description",
                "modifiers": [],
                "params": [],
                "returns": null,
                "description": "Component function description"
            }
        ],
        "props": {
            "someProp": {
                "type": {
                    "name": "custom",
                    "raw": "PropTypes.string.isrequired"
                },
                "required": false,
                "description": ""
            },
            "someMoreProp": {
                "type": {
                    "name": "custom",
                    "raw": "PropTypes.array"
                },
                "required": false,
                "description": ""
            }
        }
    },
    
    "MyOtherComponent": {
        ...
    }
    ...
}

```

# Changelog
The changelog can be found on the [Change log](https://github.com/sun1l/react-extract-component-meta/blob/master/CHANGELOG.md) page.

# Authors and license

[Sunil Kumar](https://twitter.com/sun1lkumar)

MIT License, see the included [License](https://github.com/sun1l/react-extract-component-meta/blob/master/LICENSE) file.

---
_Source: https://npm.io/package/react-extract-component-meta · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
