forked from chad828/dialog-web-components
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstyleguide.config.js
54 lines (45 loc) · 1.33 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
/* eslint global-require:0, no-sync:0 */
const fs = require('fs');
const path = require('path');
const pkg = require('./package.json');
const schema = require('./components.json');
const { theme, styles } = require('./src/styleguide/styles');
function resolve(...paths) {
return fs.realpathSync(path.join(__dirname, ...paths));
}
module.exports = {
title: `dialog components v${pkg.version}`,
serverPort: 5000,
highlightTheme: 'dracula',
sections: schema.map(({ name, content, components }) => {
return {
name,
content: content ? resolve('docs', content + '.md') : null,
components() {
return components.map((componentName) => {
return resolve(
'src/components',
componentName,
componentName + '.js'
);
});
}
};
}),
webpackConfig: require('./webpack.config'),
require: [
resolve('node_modules/core-js/shim.js'),
resolve('src/styles/global.css'),
resolve('src/styleguide/styles.css')
],
theme,
styles,
template: resolve('src/styleguide/index.html'),
getComponentPathLine(componentPath) {
const name = path.basename(componentPath, '.js');
return `import { ${name} } from '${pkg.name}';`;
},
getExampleFilename(componentPath) {
return componentPath.replace(/[\w\d]+\.js$/i, 'README.md');
}
};