-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstyleguide.config.js
66 lines (58 loc) · 1.98 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
/* eslint strict: [0, "global"] */
/* eslint import/no-extraneous-dependencies: 0 */
'use strict';
const path = require('path');
const merge = require('webpack-merge');
const reactDoc = require('library-utils/react-doc');
const upperCamelCase = require('uppercamelcase');
const WEBPACK_BASE_TEMPLATE = require('./webpack.base');
const config = require('./src/index');
const { version } = require('./package');
const PORT = parseInt(process.env.PORT || 8080, 10);
const TITLE = 'arui-demo';
// Prepare styleguidist context https://react-styleguidist.js.org/docs/configuration.html#context
// For share example functionality
module.exports = {
...config,
require: [
'./src/global.css'
],
title: TITLE,
version,
serverPort: PORT,
skipComponentsWithoutExample: true,
components: 'components/**/*.jsx',
propsParser(filePath) {
return reactDoc(filePath);
},
getComponentPathLine(filePath) {
const componentDirName = path.dirname(filePath);
const componentSourcesFileName = componentDirName.split(path.sep).pop();
const componentName = upperCamelCase(componentSourcesFileName);
return `import ${componentName} from '${TITLE}/${componentSourcesFileName}';`;
},
getExampleFilename(componentPath) {
return path.resolve(path.dirname(componentPath), './README.md');
},
moduleAliases: {
'rsg-components/': path.resolve(__dirname, './node_modules/react-styleguidist/lib/client/rsg-components/'),
'arui-demo': path.resolve(__dirname, './src/')
},
ignore: ['**/*-test.jsx'],
styleguideDir: path.resolve(__dirname, './demo/styleguide/'),
webpackConfig: merge.smart(WEBPACK_BASE_TEMPLATE, {
resolve: {
extensions: ['.js', '.jsx']
},
devServer: {
disableHostCheck: true
}
}),
sections: [
{
title: 'Components',
components: './components/**/*.jsx',
sectionDepth: 1
}
]
};