Skip to content

Commit 153c7db

Browse files
thomastvedtsapegin
authored andcommitted
Docs: Added Create React App + Typescript info (styleguidist#610)
1 parent 8dd8cbd commit 153c7db

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

Readme.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ Real projects using React Styleguidist:
4545
## Integration with other tools
4646

4747
* Create React App — just works, see the [Getting Started](https://react-styleguidist.js.org/docs/getting-started.html) guide!
48-
* [TypeScript](https://github.com/styleguidist/react-docgen-typescript)
48+
* Create React App + TypeScript, see [Configuring webpack](https://react-styleguidist.js.org/docs/webpack.html)
49+
* TypeScript, see [react-docgen-typescript](https://github.com/styleguidist/react-docgen-typescript)
4950

5051
## Resources
5152

docs/Webpack.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,21 @@ module.exports = {
7777

7878
[Create React App](https://github.com/facebookincubator/create-react-app) is supported out of the box, you don’t even need to create a style guide config if your components could be found using a default glob pattern, `src/components/**/*.{js,jsx}`.
7979

80+
## Create React App, TypeScript
81+
82+
If you're using [Create React App](https://github.com/facebookincubator/create-react-app) and Typescript, you need to:
83+
- Install [react-docgen-typescript](https://github.com/styleguidist/react-docgen-typescript)
84+
- Create a `styleguide.config.js`, see [this guide](Configuration.md)
85+
- Add a `components`, `webpackConfig` and `propsParser` section to your `styleguide.config.js`:
86+
87+
```javascript
88+
module.exports = {
89+
components: 'src/components/**/*.{ts,tsx}',
90+
propsParser: require('react-docgen-typescript').parse,
91+
webpackConfig: require('react-scripts-ts/config/webpack.config.dev.js')
92+
}
93+
```
94+
8095
## Non-webpack projects
8196

8297
If your project doesn’t use webpack you still need loaders for your files. You can use [webpack-blocks](https://github.com/andywer/webpack-blocks).

0 commit comments

Comments
 (0)