package
A webpack plugin to inject react typescript docgen information.
npm install react-docgen-typescript-pluginGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
A webpack plugin to inject react typescript docgen information
npm install --save-dev react-docgen-typescript-plugin
# or
yarn add -D react-docgen-typescript-pluginNOTE: The TypeScript compiler options
allowSyntheticDefaultImportsandesModuleInteropwill makereact-docgen-typescript-plugina lot harder! Turn them off for faster build times.
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 } }),
],
};This plugins support all parser options from react-docgen-typescript 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 |
If you want to see how this plugins is including and excluding modules set the DEBUG environment variable.
DEBUG=docgen:* - All logsDEBUG=docgen:include - Included modulesDEBUG=docgen:exclude - Excluded modulesDEBUG=docgen:docs - Generated docsDEBUG=docgen:* npm run storybookAnother great way of debugging your generated docs is to use a
debuggerstatement in your component source file. If you turn off source maps you will be able to see the code that this package generates.
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!
Estimated unpacked size across 21 packages.
2.1 MB
Includes dependencies.
| 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'] |
Michael Shilman 💻 |
Kyle Herock 💻 |
Juho Vepsäläinen 🚇 ⚠️ 💻 📖 |
Egor Pogadaev ⚠️ 💻 |
Anton Savoskin 💻 |
Trevor Burnham ⚠️ 💻 |
Maxime Meriouma-Caron 🚇 ⚠️ 💻 | Adam Skoufis 💻 | Nicholas Narsing 📖 ⚠️ 💻 |
^2.6.2
2.9.1
^3.0.4
6.1.23
^4.0.2
4.0.8
^3.3.1
6.0.0
^2.2.2
2.4.0