-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyleguide.config.js
63 lines (60 loc) · 1.4 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
const path = require('path');
const { name: packageName, version, description } = require('./package.json');
const { theme, styles } = require('./styleguide/styles');
module.exports = {
title: description,
pagePerSection: true,
version,
theme,
styles,
skipComponentsWithoutExample: true,
sections: [
{
components: 'src/**/*.{jsx,tsx,ts,js}',
content: 'README.md',
exampleMode: 'expand',
pagePerSection: true,
sectionDepth: 1,
usageMode: 'expand',
},
],
styleguideDir: './docs',
styleguideComponents: {
StyleGuideRenderer: path.join(
__dirname,
'styleguide/rsg/StyleGuideRenderer',
),
},
getComponentPathLine(p) {
let componentName = path.basename(p).split('.')[0];
if (componentName === 'Methods') {
return '';
}
return `import { ${componentName} } from '${packageName}';`;
},
propsParser: require('react-docgen-typescript').withCustomConfig(
'./tsconfig.json',
).parse,
webpackConfig: {
module: {
rules: [
{
test: /\.(t|j)sx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
},
],
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json'],
alias: {
[packageName]: path.resolve(__dirname, 'src'),
},
},
devtool: 'source-map',
devServer: {
compress: true,
https: true,
},
},
};