-
Notifications
You must be signed in to change notification settings - Fork 2
/
styleguide.config.js
38 lines (36 loc) · 1.01 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
const fs = require('fs');
const path = require('path');
module.exports = {
components: getComponentsPaths('src/components'),
require: [path.join(__dirname, 'src/index.scss')],
serverPort: 3040,
skipComponentsWithoutExample: true,
styleguideComponents: {
Wrapper: path.join(__dirname, 'src/styleguide/wrapper'),
},
theme: {
fontFamily: {
base: 'var(--dc-font-base)',
},
},
title: 'FbTools Components',
};
/**
* Returns array of paths to components.
* @param {string} componentsDirectory - The path to a directory where components are located.
* @returns {string[]}
*/
function getComponentsPaths(componentsDirectory) {
return fs
.readdirSync(componentsDirectory)
.filter((filename) => {
if (filename.startsWith('.')) {
return false;
}
const stats = fs.statSync(path.join(componentsDirectory, filename));
return stats.isDirectory();
})
.map((directoryName) =>
path.join(componentsDirectory, directoryName, `${directoryName}.tsx`)
);
}