-
Notifications
You must be signed in to change notification settings - Fork 5
/
styleguide.config.js
63 lines (58 loc) · 1.76 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
/* eslint-disable @typescript-eslint/no-var-requires */
const path = require('path');
const { readdirSync } = require('fs');
/**
* Collect sections from src directory
*
* @returns {Object[]} list of sections
*/
function getSections() {
const componentDir = 'src/components';
const sections = readdirSync(componentDir, { withFileTypes: true })
.filter((dirent) => dirent.isDirectory())
.map((dirent) => ({
name: dirent.name,
components: `${path.join(componentDir, dirent.name)}/**/*.tsx`,
content: `${path.join(componentDir, dirent.name)}/README.md`,
sectionDepth: 1,
}));
return sections;
}
module.exports = {
propsParser: require('react-docgen-typescript').withDefaultConfig().parse,
styleguideDir: 'docs-build',
ignore: [
'**/__snapshots__/**',
'**/__mocks__/**',
'**/*.test.{js,jsx,ts,tsx}',
'**/*.d.ts',
'src/components/index.ts',
],
pagePerSection: true,
sections: [
{
name: 'Introduction',
content: 'README.md',
sectionDepth: 1,
},
...getSections(),
],
require: [
path.resolve(__dirname, 'node_modules/@patternfly/patternfly/patternfly.css'),
path.resolve(__dirname, 'node_modules/@patternfly/react-core/dist/styles/base.css'),
],
title: 'KubeVirt UI',
usageMode: 'expand',
webpackConfig: require('./styleguide/webpack.config.js'),
theme: './styleguide/theme.ts',
styles: './styleguide/styles.ts',
styleguideComponents: {
LogoRenderer: path.join(__dirname, 'styleguide/components/Logo'),
StyleGuideRenderer: path.join(__dirname, 'styleguide/components/StyleGuideRenderer'),
TypeRenderer: path.join(__dirname, 'styleguide/components/Type'),
},
template: {
favicon: './favicon-32x32.png',
},
assetsDir: path.join(__dirname, 'public'),
};