-
Notifications
You must be signed in to change notification settings - Fork 21
/
styleguide.config.js
45 lines (39 loc) · 1.19 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
const path = require('path');
const endsWith = require('lodash/endsWith');
const fs = require('fs');
function brc(name) {
return path.resolve(__dirname, `src/${name}/${name}`);
}
const brcComponents = fs
.readdirSync(path.resolve(__dirname, 'src'))
.filter(c => ['index.ts', '.DS_Store', 'utils', 'Scroll', 'TransitionWrapper'].indexOf(c) === -1)
.map(brc);
console.log(brcComponents);
module.exports = {
// build
serverPort: 8080,
require: [
// "global" setup + sass imports
path.resolve(__dirname, 'styleguide/setup.ts')
],
styleguideComponents: {
StyleGuideRenderer: path.join(__dirname, 'styleguide/StyleGuideRenderer.tsx')
},
// content
title: 'buildo-react-components',
// template: 'styleguide/index.html',
propsParser: require('react-docgen-typescript').parse, // detect docs using TS information
sections: [
{
name: 'Components',
components: 'src/**/[A-Z]*.tsx'
}
],
exampleMode: 'expand',
getExampleFilename(componentPath) {
const name = endsWith(componentPath, '.tsx')
? path.basename(componentPath, '.tsx')
: path.basename(componentPath, '.ts');
return path.resolve(__dirname, `src/${name}/Examples.md`);
}
};