-
Notifications
You must be signed in to change notification settings - Fork 58
/
styleguide.config.cjs
112 lines (111 loc) · 2.9 KB
/
styleguide.config.cjs
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
const path = require('path');
const webpackCommonConf = require('./webpack.common.config.cjs');
const reactDogGenTypeScript = require('react-docgen-typescript');
module.exports = {
title: 'react-geo',
styleguideDir: './build/styleguide',
webpackConfig: {
...webpackCommonConf,
mode: process.env.NODE_ENV
},
usageMode: 'expand',
template: {
favicon: 'https://terrestris.github.io/react-geo/assets/favicon.ico'
},
minimize: process.env.NODE_ENV === 'production',
propsParser: process.env.NODE_ENV === 'production' ?
reactDogGenTypeScript
.withCustomConfig('./tsconfig.json', {
propFilter: (prop) => {
if (prop.parent) {
return !prop.parent.fileName.includes('node_modules');
}
return true;
}})
.parse :
undefined,
ignore: [
'**/__tests__/**',
'**/*.spec.{js,jsx,ts,tsx}',
'**/*.d.ts'
],
theme: {
sidebarWidth: 350,
mq: {
small: '@media (max-width: 600px)'
}
},
getExampleFilename(componentPath) {
return componentPath.replace(/\.tsx?$/, '.example.md');
},
skipComponentsWithoutExample: true,
getComponentPathLine(componentPath) {
const name = path.basename(componentPath, '.js');
const dir = path.dirname(componentPath).replace('src', 'dist');
return `import ${name} from '@terrestris/react-geo/${dir}/${name}';`;
},
moduleAliases: {
// rewrite the example sources internally to the src folder to use e.g. hot reloading
'@terrestris/react-geo/dist': path.resolve(__dirname, 'src')
},
require: [
'whatwg-fetch',
'ol/ol.css',
'antd/dist/reset.css'
],
pagePerSection: true,
sections: [{
name: 'Introduction',
content: 'README.md',
sectionDepth: 1,
}, {
name: 'Components',
sectionDepth: 3,
sections: [{
name: 'BackgroundLayerChooser',
components: 'src/BackgroundLayerChooser/**/*.tsx'
}, {
name: 'Buttons',
components: 'src/Button/**/*.tsx'
}, {
name: 'CircleMenu',
components: 'src/CircleMenu/**/*.tsx'
}, {
name: 'Containers',
components: 'src/Container/**/*.tsx'
}, {
name: 'Context',
components: 'src/Context/**/*.tsx'
}, {
name: 'CoordinateInfo',
components: 'src/CoordinateInfo/**/*.tsx'
}, {
name: 'Fields',
components: 'src/Field/**/*.tsx'
}, {
name: 'Grids',
components: 'src/Grid/**/*.tsx'
}, {
name: 'Hooks',
components: 'src/Hook/**/*.ts'
}, {
name: 'LayerSwitcher',
components: 'src/LayerSwitcher/**/*.tsx'
}, {
name: 'LayerTree',
components: 'src/LayerTree/**/*.tsx'
}, {
name: 'Legend',
components: 'src/Legend/**/*.tsx'
}, {
name: 'Map',
components: 'src/Map/**/*.tsx'
}, {
name: 'Panel',
components: 'src/Panel/**/*.tsx'
}, {
name: 'Slider',
components: 'src/Slider/**/*.tsx'
}]
}]
};