forked from alfa-laboratory/arui-feather
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyleguide.config.js
51 lines (47 loc) · 1.89 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
/* eslint strict: [0, "global"] */
/* eslint import/no-extraneous-dependencies: 0 */
'use strict';
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const reactDoc = require('library-utils/react-doc');
const upperCamelCase = require('uppercamelcase');
const WEBPACK_BASE_TEMPLATE = require('arui-presets/webpack.base');
const WEBPACK_DEV_TEMPLATE = require('arui-presets/webpack.development');
const PORT = parseInt(process.env.PORT || 8080, 10);
const TITLE = 'arui-feather';
module.exports = {
title: TITLE,
serverPort: PORT,
skipComponentsWithoutExample: true,
components: './src/*/index.js',
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');
},
ignore: ['**/*-test.jsx'],
styleguideDir: path.resolve(__dirname, './demo/styleguide/'),
styleguideComponents: {
StyleGuide: path.resolve(__dirname, './demo/components/styleguide'),
slots: path.resolve(__dirname, './demo/components/slots')
},
template: path.resolve(__dirname, './demo/template.html'),
webpackConfig: merge.smart(WEBPACK_BASE_TEMPLATE, WEBPACK_DEV_TEMPLATE, {
devServer: {
disableHostCheck: true
},
plugins: [
new webpack.NormalModuleReplacementPlugin(/^arui-feather/, (resource) => {
resource.request = resource.request.replace(/^arui-feather/, path.resolve(__dirname, './src'));
})
]
})
};