1 | const env = process.env.NODE_ENV;
|
2 | const pkg = require('./package.json');
|
3 | const path = require('path');
|
4 |
|
5 | const isDevEnv = env === 'development';
|
6 | const { webpack: webpackConfig } = require('./webpack.config.js');
|
7 |
|
8 | webpackConfig.module.rules.push({
|
9 | test: /\.css$/,
|
10 | use: ['style-loader', 'css-loader'],
|
11 | });
|
12 |
|
13 | module.exports = {
|
14 | styleguideDir: 'docs',
|
15 |
|
16 | title: 'ReadMe UI',
|
17 | pagePerSection: true,
|
18 |
|
19 | usageMode: isDevEnv ? 'expand' : 'collapse',
|
20 | exampleMode: 'collapse',
|
21 | template: {
|
22 | head: {
|
23 | links: [
|
24 | {
|
25 | rel: 'stylesheet',
|
26 | href: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.11.2/css/all.min.css',
|
27 | },
|
28 | ],
|
29 | },
|
30 | },
|
31 | sections: [
|
32 | { name: 'ReadMe UI', content: 'docs/src/home.md', sectionDepth: 0 },
|
33 | {
|
34 | name: 'Overview',
|
35 | content: 'readme.md',
|
36 | sectionDepth: 1,
|
37 | sections: [
|
38 | {
|
39 | name: 'Usage',
|
40 | content: 'docs/src/usage/index.md',
|
41 | sections: [
|
42 | { name: 'Getting Started', content: 'docs/src/usage/getting-started.md' },
|
43 | { name: 'Usage in ReadMe', content: 'docs/src/usage/directive.md' },
|
44 | { name: 'Custom Hooks', content: 'docs/src/usage/custom-hooks.md' },
|
45 | ],
|
46 | },
|
47 | {
|
48 | name: 'Contributing',
|
49 | content: 'docs/src/contributing/index.md',
|
50 | sectionDepth: 0,
|
51 | sections: [
|
52 | { name: 'Code Conventions', content: 'docs/src/contributing/coding.md' },
|
53 | { name: 'Pull Requests', content: 'docs/src/contributing/git-prs.md' },
|
54 | ],
|
55 | },
|
56 | {
|
57 | name: 'Quick Composer',
|
58 | exampleMode: 'expand',
|
59 | content: 'docs/src/quick-composer.md',
|
60 | },
|
61 | ],
|
62 | },
|
63 | {
|
64 | name: 'Design System',
|
65 | content: 'src/styles/readme.md',
|
66 | sections: [
|
67 |
|
68 | { name: 'Design Tokens', content: 'src/styles/tokens/readme.md' },
|
69 | { name: 'Mixins & Methods', content: 'src/styles/methods/readme.md' },
|
70 | { name: 'Class Conventions', content: 'docs/src/styles/bem.md' },
|
71 | { name: 'Utility', content: 'src/styles/base/readme.md' },
|
72 | ],
|
73 | },
|
74 | {
|
75 | name: 'UI Library',
|
76 | content: 'src/ui/readme.md',
|
77 | sectionDepth: 1,
|
78 | sections: [
|
79 | {
|
80 | name: 'Components',
|
81 | content: 'src/ui/components/readme.md',
|
82 | components: ['src/ui/components/**/index.{js,jsx}'],
|
83 | ignore: ['src/ui/components/index.js'],
|
84 | },
|
85 | {
|
86 | name: 'Compositions',
|
87 | content: 'src/ui/compositions/readme.md',
|
88 | components: ['src/ui/compositions/*/index.{js,jsx}'],
|
89 | ignore: ['src/ui/compositions/index.js'],
|
90 | },
|
91 | {
|
92 | name: 'Views',
|
93 | components: ['src/views/*/index.{js,jsx}'],
|
94 | ignore: ['src/views/index.js'],
|
95 | },
|
96 | isDevEnv
|
97 | ? {
|
98 | name: 'Marketing',
|
99 | components: ['src/ui/marketing/*/index.{js,jsx}'],
|
100 | ignore: ['src/ui/marketing/index.js'],
|
101 | }
|
102 | : {},
|
103 | ],
|
104 | },
|
105 | isDevEnv
|
106 | ? {
|
107 | name: 'Repository',
|
108 | href: pkg.repository.url.split('git+').join(''),
|
109 | }
|
110 | : {
|
111 | name: 'NPM Registry',
|
112 | href: `https://www.npmjs.com/package/${pkg.name}`,
|
113 | },
|
114 | ],
|
115 | require: [
|
116 | path.join(__dirname, 'docs/lib/style.css'),
|
117 | path.join(__dirname, 'docs/lib/toggle-props.css'),
|
118 | path.join(__dirname, 'src/styles/main.scss'),
|
119 | path.join(__dirname, 'docs/lib/nav-toggling.js'),
|
120 | ],
|
121 |
|
122 | webpackConfig,
|
123 | };
|