forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
106 lines (103 loc) · 2.42 KB
/
index.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
const path = require('path');
const homeTmpl = './template/Home/index';
const contentTmpl = './template/Content/index';
const resourcesTmpl = './template/Resources/index';
const appShellTmpl = './template/AppShell';
function pickerGenerator(module) {
const tester = new RegExp(`^docs/${module}`);
return markdownData => {
const { filename } = markdownData.meta;
if (tester.test(filename) && !/\/demo$/.test(path.dirname(filename))) {
return {
meta: markdownData.meta,
};
}
return null;
};
}
module.exports = {
lazyLoad(nodePath, nodeValue) {
if (typeof nodeValue === 'string') {
return true;
}
return nodePath.endsWith('/demo');
},
pick: {
components(markdownData) {
const { filename } = markdownData.meta;
if (!/^components/.test(filename) || /[/\\]demo$/.test(path.dirname(filename))) {
return null;
}
return {
meta: markdownData.meta,
};
},
changelog(markdownData) {
if (/CHANGELOG/.test(markdownData.meta.filename)) {
return {
meta: markdownData.meta,
};
}
return null;
},
'docs/react': pickerGenerator('react'),
'docs/spec': pickerGenerator('spec'),
},
plugins: [
'bisheng-plugin-description',
'bisheng-plugin-toc?maxDepth=2&keepElem',
'@ant-design/bisheng-plugin?injectProvider',
'bisheng-plugin-react?lang=__react',
],
routes: {
path: '/',
component: './template/Layout/index',
indexRoute: { component: homeTmpl },
childRoutes: [
{
path: 'app-shell',
component: appShellTmpl,
},
{
path: 'index-cn',
component: homeTmpl,
},
{
path: 'docs/react/:children',
component: contentTmpl,
},
{
path: 'changelog',
component: contentTmpl,
},
{
path: 'changelog-cn',
component: contentTmpl,
},
{
path: 'components/form/v3',
component: contentTmpl,
},
{
path: 'components/form/v3-cn',
component: contentTmpl,
},
{
path: 'components/:children/',
component: contentTmpl,
},
{
path: 'docs/spec/:children',
component: contentTmpl,
},
{
path: 'docs/resources',
component: resourcesTmpl,
},
{
path: 'docs/resources-cn',
component: resourcesTmpl,
},
],
},
};