2017-01-20 11:47:08 +08:00
|
|
|
const path = require('path');
|
|
|
|
|
2016-12-09 13:02:16 +08:00
|
|
|
const homeTmpl = './template/Home/index';
|
2016-05-27 11:48:08 +08:00
|
|
|
const contentTmpl = './template/Content/index';
|
2018-06-02 12:46:09 +08:00
|
|
|
const appShellTmpl = './template/AppShell';
|
2016-05-27 11:48:08 +08:00
|
|
|
|
2017-01-20 11:47:08 +08:00
|
|
|
function pickerGenerator(module) {
|
|
|
|
const tester = new RegExp(`^docs/${module}`);
|
2018-12-07 16:17:45 +08:00
|
|
|
return markdownData => {
|
2017-10-09 13:23:20 +08:00
|
|
|
const { filename } = markdownData.meta;
|
2018-12-07 16:17:45 +08:00
|
|
|
if (tester.test(filename) && !/\/demo$/.test(path.dirname(filename))) {
|
2017-01-20 11:47:08 +08:00
|
|
|
return {
|
|
|
|
meta: markdownData.meta,
|
|
|
|
};
|
|
|
|
}
|
2018-11-28 15:00:03 +08:00
|
|
|
return null;
|
2017-01-20 11:47:08 +08:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-06-03 13:21:27 +08:00
|
|
|
module.exports = {
|
2017-01-20 11:47:08 +08:00
|
|
|
lazyLoad(nodePath, nodeValue) {
|
|
|
|
if (typeof nodeValue === 'string') {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return nodePath.endsWith('/demo');
|
2016-03-07 11:35:23 +08:00
|
|
|
},
|
2017-01-20 11:47:08 +08:00
|
|
|
pick: {
|
|
|
|
components(markdownData) {
|
2017-10-09 13:23:20 +08:00
|
|
|
const { filename } = markdownData.meta;
|
2018-12-07 16:17:45 +08:00
|
|
|
if (!/^components/.test(filename) || /[/\\]demo$/.test(path.dirname(filename))) {
|
2018-11-28 15:00:03 +08:00
|
|
|
return null;
|
|
|
|
}
|
2017-01-20 11:47:08 +08:00
|
|
|
return {
|
|
|
|
meta: markdownData.meta,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
changelog(markdownData) {
|
|
|
|
if (/CHANGELOG/.test(markdownData.meta.filename)) {
|
|
|
|
return {
|
|
|
|
meta: markdownData.meta,
|
|
|
|
};
|
|
|
|
}
|
2018-11-28 15:00:03 +08:00
|
|
|
return null;
|
2017-01-20 11:47:08 +08:00
|
|
|
},
|
|
|
|
'docs/react': pickerGenerator('react'),
|
|
|
|
'docs/spec': pickerGenerator('spec'),
|
2016-05-11 09:32:33 +08:00
|
|
|
},
|
2017-01-20 11:47:08 +08:00
|
|
|
plugins: [
|
|
|
|
'bisheng-plugin-description',
|
|
|
|
'bisheng-plugin-toc?maxDepth=2&keepElem',
|
2018-11-26 12:06:42 +08:00
|
|
|
'bisheng-plugin-antd?injectProvider',
|
2017-01-20 11:47:08 +08:00
|
|
|
'bisheng-plugin-react?lang=__react',
|
|
|
|
],
|
2016-05-27 11:48:08 +08:00
|
|
|
routes: {
|
2016-07-26 15:24:48 +08:00
|
|
|
path: '/',
|
|
|
|
component: './template/Layout/index',
|
2016-12-09 13:02:16 +08:00
|
|
|
indexRoute: { component: homeTmpl },
|
2018-12-07 16:17:45 +08:00
|
|
|
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/:children/',
|
|
|
|
component: contentTmpl,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
path: 'docs/spec/:children',
|
|
|
|
component: contentTmpl,
|
|
|
|
},
|
|
|
|
],
|
2016-05-27 11:48:08 +08:00
|
|
|
},
|
2016-03-07 11:35:23 +08:00
|
|
|
};
|