-
Notifications
You must be signed in to change notification settings - Fork 10
/
styleguide.config.js
91 lines (85 loc) · 1.78 KB
/
styleguide.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/* eslint-disable */
const glob = require("glob");
const path = require("path");
const docGen = require("react-docgen-typescript");
const excludePatterns = [
".stories.",
".argTypes.",
".test.",
".styles.",
".props.",
"index.ts",
"__fixtures__",
"__snapshots__",
"__mocks__",
"Template.tsx",
"getFontSize.ts",
"getColorProp.ts",
"Skeleton",
"CssBaseline",
"constants.ts",
"getVariantForMaterial.ts"
];
const getComponents = () => glob
.sync("packages/web/src/Components/**/*.{ts,tsx}")
.filter((file) => {
const matchExcludedPattern = excludePatterns
.find((pattern) => file.includes(pattern));
return !matchExcludedPattern;
});
const propsParser = docGen.withDefaultConfig({
savePropValueAsString: true,
}).parse;
module.exports = {
propsParser,
usageMode: "expand",
exampleMode: "hide",
styleguideDir: "build/props",
pagePerSection: true,
sections: [
{
name: "Getting Started",
sections: [
{
name: "Read me",
content: "README.md",
},
{
name: "Icons",
content: "packages/web/docs/icons.md",
},
{
name: "Contributing",
content: "CONTRIBUTING.md",
},
{
name: "Troubleshooting",
content: "TROUBLESHOOTING.md",
},
],
sectionDepth: 2,
},
{
name: "Components",
components: getComponents,
sectionDepth: 1,
},
],
webpackConfig: {
resolve: {
extensions: [".tsx", ".ts"],
},
module: {
rules: [
{
test: /\.tsx?$/,
include: path.resolve(__dirname, 'packages/web/src'),
loader: "ts-loader",
options: {
transpileOnly: true
}
},
],
},
},
};