# @storybook/react-docgen-typescript-plugin

> A webpack plugin to inject react typescript docgen information.

Latest version **1.0.1** (published 2021-07-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @storybook/react-docgen-typescript-plugin
pnpm add @storybook/react-docgen-typescript-plugin
yarn add @storybook/react-docgen-typescript-plugin
bun add @storybook/react-docgen-typescript-plugin
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2021-07-30 |
| First published | 2021-05-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 7 |
| Unpacked size | 65.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 69 |
| Author | Andrew Lisowski |
| Maintainers | ndelangen, shilman, alexandrebodin, hypnosphi, danielduan, igor-dv, pksunkara, tmeasday, gongreg, domyen, usulpro, kylesuss, ghengeveld, pago, dandean, codebyalex, mrmckeb, dannyhw, winkervsbecks, rvasikarla, amalik2, lshadler, phated, yannbf, dylanpiercey, monkeyworks, darleendenno |
| Keywords | react, docgen, typescript, webpack, plugin |

## Links

- npm: https://www.npmjs.com/package/@storybook/react-docgen-typescript-plugin
- Repository: https://github.com/hipstersmoothie/react-docgen-typescript-plugin
- npm.io page: https://npm.io/package/@storybook/react-docgen-typescript-plugin

## Dependencies (7)

- [debug](https://npm.io/package/debug.md) ^4.1.1
- [tslib](https://npm.io/package/tslib.md) ^2.0.0
- [endent](https://npm.io/package/endent.md) ^2.0.1
- [flat-cache](https://npm.io/package/flat-cache.md) ^3.0.4
- [micromatch](https://npm.io/package/micromatch.md) ^4.0.2
- [find-cache-dir](https://npm.io/package/find-cache-dir.md) ^3.3.1
- [react-docgen-typescript](https://npm.io/package/react-docgen-typescript.md) ^2.0.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

- 1.0.1 (latest) — 2021-07-30
- 1.0.2--canary.12.cf35881ff63bf958b8998e8dd1dfd5626ee868c2.0 (canary) — 2023-06-13
- 1.0.2-next.0 (next) — 2023-06-13
- 1.0.2--canary.11.6da43ba36bdc1d30a6e096c567234deb91775b14.0 — 2023-06-13
- 1.0.6--canary.9.0c3f3b7.0 — 2023-04-11
- 1.0.6--canary.9.630821.0 — 2023-03-20
- 1.0.6--canary.9.cd77847.0 — 2023-03-03
- 1.0.6--canary.9.f9c48c0.0 — 2023-03-03
- 1.0.2--canary.7.391457fcf6c823971cf02d8e74dbf8e242872b26.0 — 2023-02-14
- 1.0.2--canary.7.324a727c65a1819f7f3ede5abc1f32d440e4530a.0 — 2022-11-17
- 1.0.2-canary.6.9d540b91e815f8fc2f8829189deb00553559ff63.0 — 2021-11-30
- 1.0.2-canary.187a82f.0 — 2021-07-30
- 1.0.2-canary.253f8c1.0 — 2021-06-30
- 1.0.2-canary.424ea79.0 — 2021-06-30
- 1.0.2-canary.3c70e01.0 — 2021-06-18
- … 6 more at https://npm.io/package/@storybook/react-docgen-typescript-plugin/versions

## README

<div align="center">
  <img  height="200"
    src="https://upload.wikimedia.org/wikipedia/commons/thumb/a/a7/React-icon.svg/512px-React-icon.svg.png">
  <h1>react-docgen-typescript-plugin</h1>
  <p>A webpack plugin to inject react typescript docgen information</p>
</div>

## Install

```sh
npm install --save-dev react-docgen-typescript-plugin
# or
yarn add -D react-docgen-typescript-plugin
```

## Usage

> NOTE: The TypeScript compiler options `allowSyntheticDefaultImports` and `esModuleInterop` will make
> `react-docgen-typescript-plugin` a lot harder! Turn them off for faster build times.

```ts
const ts = require('typescript');
const ReactDocgenTypescriptPlugin = require("react-docgen-typescript-plugin").default;

module.exports = {
  plugins: [
    // Will default to loading your root tsconfig.json
    new ReactDocgenTypescriptPlugin(),
    // or with a specific tsconfig
    new ReactDocgenTypescriptPlugin({ tsconfigPath: "./tsconfig.dev.json" }),
    // or with compiler options
    new ReactDocgenTypescriptPlugin({ compilerOptions: { jsx: ts.JsxEmit.Preserve } }),
  ],
};
```

### Options

This plugins support all parser options from [react-docgen-typescript](https://github.com/styleguidist/react-docgen-typescript#parseroptions) and all of the following options

| Option               | Type           | Description                                                                                                                                         | Default                   |
| -------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------- |
| tsconfigPath         | string         | Specify the location of the `tsconfig.json` to use.                                                                                                 | `null`                    |
| compilerOptions      | object         | Specify compiler options. Cannot be used with `tsconfigPath`                                                                                        | `null`                    |
| docgenCollectionName | string or null | Specify the docgen collection name to use. All docgen information will be collected into this global object. Set to `null` to disable.              | `STORYBOOK_REACT_CLASSES` |
| setDisplayName       | boolean        | Set the components' display name. If you want to set display names yourself or are using another plugin to do this, you should disable this option. | `true`                    |
| typePropName         | string         | Specify the name of the property for docgen info prop type.                                                                                         | `type`                    |
| exclude              | glob[]         | Glob patterns to ignore and not generate docgen information for. (Great for ignoring large icon libraries)                                          | `[]`                        |
| include              | glob[]         | Glob patterns to generate docgen information for                                                                                                    | `['**/**.tsx']`             |

## Debugging

If you want to see how this plugins is including and excluding modules set the `DEBUG` environment variable.

- `DEBUG=docgen:*` - All logs
- `DEBUG=docgen:include` - Included modules
- `DEBUG=docgen:exclude` - Excluded modules
- `DEBUG=docgen:docs` - Generated docs

```bash
DEBUG=docgen:* npm run storybook
```

> Another great way of debugging your generated docs is to use a `debugger` statement in your component source file.
> If you turn off source maps you will be able to see the code that this package generates.

## Prior Art

- [sn-client](https://github.com/SenseNet/sn-client/) - Inspired by this custom webpack plugin
- [react-docgen-typescript-loader](https://github.com/strothj/react-docgen-typescript-loader/) - Webpack loader to generate docgen information from Typescript React components.

## Contributors ✨

Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
  <tr>
    <td align="center"><a href="http://hipstersmoothie.com/"><img src="https://avatars3.githubusercontent.com/u/1192452?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Andrew Lisowski</b></sub></a><br /><a href="https://github.com/hipstersmoothie/react-docgen-typescript-plugin/commits?author=hipstersmoothie" title="Code">💻</a> <a href="#design-hipstersmoothie" title="Design">🎨</a> <a href="https://github.com/hipstersmoothie/react-docgen-typescript-plugin/commits?author=hipstersmoothie" title="Documentation">📖</a> <a href="#ideas-hipstersmoothie" title="Ideas, Planning, & Feedback">🤔</a> <a href="#maintenance-hipstersmoothie" title="Maintenance">🚧</a> <a href="#infra-hipstersmoothie" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/hipstersmoothie/react-docgen-typescript-plugin/commits?author=hipstersmoothie" title="Tests">⚠️</a></td>
    <td align="center"><a href="http://shilman.net/"><img src="https://avatars2.githubusercontent.com/u/488689?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Michael Shilman</b></sub></a><br /><a href="https://github.com/hipstersmoothie/react-docgen-typescript-plugin/commits?author=shilman" title="Code">💻</a></td>
    <td align="center"><a href="https://github.com/kherock"><img src="https://avatars.githubusercontent.com/u/4993980?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Kyle Herock</b></sub></a><br /><a href="https://github.com/hipstersmoothie/react-docgen-typescript-plugin/commits?author=kherock" title="Code">💻</a></td>
    <td align="center"><a href="https://survivejs.com/"><img src="https://avatars.githubusercontent.com/u/166921?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Juho Vepsäläinen</b></sub></a><br /><a href="#infra-bebraw" title="Infrastructure (Hosting, Build-Tools, etc)">🚇</a> <a href="https://github.com/hipstersmoothie/react-docgen-typescript-plugin/commits?author=bebraw" title="Tests">⚠️</a> <a href="https://github.com/hipstersmoothie/react-docgen-typescript-plugin/commits?author=bebraw" title="Code">💻</a></td>
  </tr>
</table>

<!-- markdownlint-restore -->
<!-- prettier-ignore-end -->

<!-- ALL-CONTRIBUTORS-LIST:END -->

This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!

---
_Source: https://npm.io/package/@storybook/react-docgen-typescript-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
