Gathering detailed insights and metrics for react-docgen-typescript-webpack-plugin
Gathering detailed insights and metrics for react-docgen-typescript-webpack-plugin
Gathering detailed insights and metrics for react-docgen-typescript-webpack-plugin
Gathering detailed insights and metrics for react-docgen-typescript-webpack-plugin
@storybook/react-docgen-typescript-plugin
A webpack plugin to inject react typescript docgen information.
react-docgen-typescript-plugin
A webpack plugin to inject react typescript docgen information.
emp-proptypes-docgen-plugin
A webpack plugin to inject react typescript docgen information in cweb.
@channel.io/react-docgen-typescript-plugin
A webpack plugin to inject react typescript docgen information.
npm install react-docgen-typescript-webpack-plugin
Typescript
Module System
Min. Node Version
86.8
Supply Chain
99.4
Quality
74.9
Maintenance
100
Vulnerability
99.3
License
TypeScript (99.26%)
JavaScript (0.74%)
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
9,575,794
Last Day
2,516
Last Week
11,466
Last Month
49,456
Last Year
593,351
NOASSERTION License
361 Stars
162 Commits
46 Forks
6 Watchers
4 Branches
14 Contributors
Updated on Oct 30, 2024
Latest Version
1.1.0
Package Id
react-docgen-typescript-webpack-plugin@1.1.0
Unpacked Size
10.86 kB
Size
3.70 kB
File Count
5
Cumulative downloads
Total Downloads
Last Day
4.5%
2,516
Compared to previous day
Last Week
-4.7%
11,466
Compared to previous week
Last Month
73%
49,456
Compared to previous month
Last Year
-15.2%
593,351
Compared to previous year
2
23
Webpack plugin to generate docgen information from Typescript React components.
Add the package as a development dependency.
1$ npm install --save-dev react-docgen-typescript-webpack-plugin 2 3or 4 5$ yarn add --dev react-docgen-typescript-webpack-plugin
Add the plugin to your Webpack configuration.
1const path = require("path"); 2const genDefaultConfig = require("@storybook/react/dist/server/config/defaults/webpack.config.js"); 3const TSDocgenPlugin = require("react-docgen-typescript-webpack-plugin"); 4 5module.exports = (baseConfig, env) => { 6 const config = genDefaultConfig(baseConfig); 7 8 config.module.rules.push({ 9 test: /\.tsx?$/, 10 include: path.resolve(__dirname, "../src"), 11 loader: require.resolve("ts-loader"), 12 }); 13 14 config.plugins.push(new TSDocgenPlugin()); 15 16 config.resolve.extensions.push(".ts", ".tsx"); 17 18 return config; 19};
Include the withInfo
decorator as normal.
Special Note:
The Storybook Info addon will only attempt to read Docgen information when the
story name matches the name of the component. So if you have a component named
ColorButton
, then you will have to use something like:
storiesOf("...", module).add("ColorButton", ...)
1import * as React from "react"; 2import { storiesOf } from "@storybook/react"; 3import { withInfo } from "@storybook/addon-info"; 4import ColorButton from "./ColorButton"; 5 6storiesOf("Components", module).add( 7 "ColorButton", 8 withInfo({ inline: true })(() => ( 9 <ColorButton color="blue">Color Button</ColorButton> 10 )), 11);
This plugin is mostly a hack job at the moment. It is a work in progress so it is most likely not suitable for production. Pull requests are most welcome.
This plugin makes use of the great project: https://github.com/styleguidist/react-docgen-typescript
It is subject to the same limitations. Component docgen information can not be generated for components who are only exported as default. You can work around the issue by exporting the component using a named export.
CURRENT LIMITATION
The current implementation seems to have trouble with the compiler option module
being set to esnext
.
1import * as React from "react"; 2 3interface ColorButtonProps { 4 /** Buttons background color */ 5 color: "blue" | "green"; 6} 7 8/** A button with a configurable background color. */ 9export const ColorButton: React.SFC<ColorButtonProps> = props => ( 10 <button 11 style={{ 12 padding: 40, 13 color: "#eee", 14 backgroundColor: props.color, 15 fontSize: "2rem", 16 }} 17 > 18 {props.children} 19 </button> 20); 21 22export default ColorButton;
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 7/22 approved changesets -- score normalized to 3
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
130 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-02-10
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More