Skip to content

Commit b778081

Browse files
committed
feat: Add base Storybook config
1 parent 5995572 commit b778081

File tree

6 files changed

+26889
-0
lines changed

6 files changed

+26889
-0
lines changed

services/storybook/.babelrc.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"sourceType": "unambiguous",
3+
"presets": [
4+
[
5+
"@babel/preset-env",
6+
{
7+
"targets": {
8+
"chrome": 100
9+
}
10+
}
11+
],
12+
"@babel/preset-react"
13+
],
14+
"plugins": []
15+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { globby } from 'globby';
2+
3+
/** @type { import('@storybook/react-webpack5').StorybookConfig } */
4+
const config = {
5+
stories: async (list) => {
6+
console.log(list)
7+
const storyPaths = ["../stories/**/*.stories.mdx", "../stories/**/*.stories.@(js|jsx|ts|tsx)"];
8+
const componentDirectories = await globby(["../../components/**"], {
9+
gitignore: false,
10+
expandDirectories: false,
11+
onlyDirectories: true,
12+
deep: 1
13+
});
14+
for (const componentDirectory of componentDirectories) {
15+
const stories = await globby([
16+
`${componentDirectory}/stories/*.stories.@(mdx|js|jsx|ts|tsx)`,
17+
`${componentDirectory}/src/*.stories.@(mdx|js|jsx|ts|tsx)`
18+
], {
19+
gitignore: false,
20+
expandDirectories: false,
21+
deep: 1
22+
});
23+
storyPaths.push(...stories.map(storyPath => `../${storyPath}`));
24+
}
25+
return storyPaths;
26+
},
27+
addons: [
28+
"@storybook/addon-links",
29+
"@storybook/addon-essentials",
30+
"@storybook/addon-interactions",
31+
"@storybook/preset-scss"
32+
],
33+
framework: {
34+
name: "@storybook/react-webpack5",
35+
options: {},
36+
},
37+
docs: {
38+
autodocs: "tag",
39+
},
40+
// webpackFinal: async config => {
41+
// config.module.rules[0].exclude = [/node_modules\/(?!(gatsby|gatsby-script)\/)/]
42+
// config.resolve.mainFields = ["browser", "module", "main"]
43+
// return config
44+
// },
45+
};
46+
export default config;
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/** @type { import('@storybook/react').Preview } */
2+
const preview = {
3+
parameters: {
4+
actions: { argTypesRegex: "^on[A-Z].*" },
5+
controls: {
6+
matchers: {
7+
color: /(background|color)$/i,
8+
date: /Date$/,
9+
},
10+
},
11+
},
12+
};
13+
14+
export default preview;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
import { Link } from '@reach/router'
2+
export { Link }

0 commit comments

Comments
 (0)