Skip to content

Commit de3ecc9

Browse files
committed
Configure storybook
1 parent 3a6ad64 commit de3ecc9

6 files changed

Lines changed: 25758 additions & 4584 deletions

File tree

.storybook/addons.js

Whitespace-only changes.

.storybook/config.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import { configure } from "@storybook/react";
2+
3+
const req = require.context("../src", true, /\.stories\.tsx$/);
4+
5+
function loadStories() {
6+
req.keys().forEach(req);
7+
}
8+
9+
configure(loadStories, module);

.storybook/tsconfig.json

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"compilerOptions": {
3+
"baseUrl": "./",
4+
"allowSyntheticDefaultImports": true,
5+
"module": "es2015",
6+
"target": "es5",
7+
"lib": ["es6", "dom"],
8+
"sourceMap": true,
9+
"allowJs": false,
10+
"jsx": "react",
11+
"moduleResolution": "node",
12+
"rootDir": "../",
13+
"outDir": "dist",
14+
"noImplicitReturns": true,
15+
"noImplicitThis": true,
16+
"noImplicitAny": true,
17+
"strictNullChecks": true,
18+
"declaration": true
19+
},
20+
"include": ["src/**/*"],
21+
"exclude": [
22+
"node_modules",
23+
"build",
24+
"dist",
25+
"scripts",
26+
"acceptance-tests",
27+
"webpack",
28+
"jest",
29+
"src/setupTests.ts",
30+
"**/*/*.test.ts",
31+
"examples"
32+
]
33+
}

.storybook/webpack.config.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
module.exports = ({ config }) => {
2+
config.module.rules.push({
3+
test: /\.(ts|tsx)$/,
4+
use: [
5+
{
6+
loader: require.resolve("awesome-typescript-loader"),
7+
options: {
8+
presets: [["react-app", { flow: false, typescript: true }]],
9+
configFileName: "./.storybook/tsconfig.json",
10+
},
11+
},
12+
{
13+
loader: require.resolve("react-docgen-typescript-loader"),
14+
},
15+
],
16+
});
17+
config.resolve.extensions.push(".ts", ".tsx");
18+
return config;
19+
};

0 commit comments

Comments
 (0)