mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-11-30 11:08:45 +08:00
site: upgrade bisheng to 0.20.0
This commit is contained in:
parent
2004c13653
commit
eb254572b7
@ -86,7 +86,7 @@
|
|||||||
"babel-preset-es2015": "^6.18.0",
|
"babel-preset-es2015": "^6.18.0",
|
||||||
"babel-preset-react": "^6.16.0",
|
"babel-preset-react": "^6.16.0",
|
||||||
"babel-preset-stage-0": "^6.16.0",
|
"babel-preset-stage-0": "^6.16.0",
|
||||||
"bisheng": "^0.19.0",
|
"bisheng": "^0.20.0",
|
||||||
"bisheng-plugin-antd": "^0.8.0",
|
"bisheng-plugin-antd": "^0.8.0",
|
||||||
"bisheng-plugin-description": "^0.1.1",
|
"bisheng-plugin-description": "^0.1.1",
|
||||||
"bisheng-plugin-react": "^0.4.0",
|
"bisheng-plugin-react": "^0.4.0",
|
||||||
|
@ -1,18 +1,5 @@
|
|||||||
const path = require('path');
|
const path = require('path');
|
||||||
|
|
||||||
function pickerGenerator(module) {
|
|
||||||
const tester = new RegExp(`^docs/${module}`);
|
|
||||||
return (markdownData) => {
|
|
||||||
const filename = markdownData.meta.filename;
|
|
||||||
if (tester.test(filename) &&
|
|
||||||
!/\/demo$/.test(path.dirname(filename))) {
|
|
||||||
return {
|
|
||||||
meta: markdownData.meta,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
port: 8001,
|
port: 8001,
|
||||||
source: [
|
source: [
|
||||||
@ -21,43 +8,33 @@ module.exports = {
|
|||||||
'CHANGELOG.zh-CN.md', // TODO: fix it in bisheng
|
'CHANGELOG.zh-CN.md', // TODO: fix it in bisheng
|
||||||
'CHANGELOG.en-US.md',
|
'CHANGELOG.en-US.md',
|
||||||
],
|
],
|
||||||
lazyLoad(nodePath, nodeValue) {
|
|
||||||
if (typeof nodeValue === 'string') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return nodePath.endsWith('/demo');
|
|
||||||
},
|
|
||||||
pick: {
|
|
||||||
components(markdownData) {
|
|
||||||
const filename = markdownData.meta.filename;
|
|
||||||
if (!/^components/.test(filename) ||
|
|
||||||
/\/demo$/.test(path.dirname(filename))) return;
|
|
||||||
|
|
||||||
return {
|
|
||||||
meta: markdownData.meta,
|
|
||||||
};
|
|
||||||
},
|
|
||||||
changelog(markdownData) {
|
|
||||||
if (/CHANGELOG/.test(markdownData.meta.filename)) {
|
|
||||||
return {
|
|
||||||
meta: markdownData.meta,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
},
|
|
||||||
'docs/pattern': pickerGenerator('pattern'),
|
|
||||||
'docs/practice': pickerGenerator('practice'),
|
|
||||||
'docs/react': pickerGenerator('react'),
|
|
||||||
'docs/resource': pickerGenerator('resource'),
|
|
||||||
'docs/spec': pickerGenerator('spec'),
|
|
||||||
},
|
|
||||||
theme: './site/theme',
|
theme: './site/theme',
|
||||||
htmlTemplate: './site/theme/static/template.html',
|
htmlTemplate: './site/theme/static/template.html',
|
||||||
plugins: [
|
themeConfig: {
|
||||||
'bisheng-plugin-description',
|
categoryOrder: {
|
||||||
'bisheng-plugin-toc?maxDepth=2&keepElem',
|
十大原则: 0,
|
||||||
'bisheng-plugin-antd',
|
Principles: 0,
|
||||||
'bisheng-plugin-react?lang=__react',
|
设计基础: 1,
|
||||||
],
|
'Design Fundamental': 1,
|
||||||
|
},
|
||||||
|
typeOrder: {
|
||||||
|
General: 0,
|
||||||
|
Layout: 1,
|
||||||
|
Navigation: 2,
|
||||||
|
'Data Entry': 3,
|
||||||
|
'Data Display': 4,
|
||||||
|
Feedback: 5,
|
||||||
|
Localization: 6,
|
||||||
|
Other: 7,
|
||||||
|
},
|
||||||
|
docVersions: {
|
||||||
|
'0.9.x': 'http://09x.ant.design',
|
||||||
|
'0.10.x': 'http://010x.ant.design',
|
||||||
|
'0.11.x': 'http://011x.ant.design',
|
||||||
|
'0.12.x': 'http://012x.ant.design',
|
||||||
|
'1.x': 'http://1x.ant.design',
|
||||||
|
},
|
||||||
|
},
|
||||||
filePathMapper(filePath) {
|
filePathMapper(filePath) {
|
||||||
if (filePath === '/index.html') {
|
if (filePath === '/index.html') {
|
||||||
return ['/index.html', '/index-cn.html'];
|
return ['/index.html', '/index-cn.html'];
|
||||||
|
@ -1,30 +1,57 @@
|
|||||||
|
const path = require('path');
|
||||||
|
|
||||||
const homeTmpl = './template/Home/index';
|
const homeTmpl = './template/Home/index';
|
||||||
const contentTmpl = './template/Content/index';
|
const contentTmpl = './template/Content/index';
|
||||||
|
|
||||||
|
function pickerGenerator(module) {
|
||||||
|
const tester = new RegExp(`^docs/${module}`);
|
||||||
|
return (markdownData) => {
|
||||||
|
const filename = markdownData.meta.filename;
|
||||||
|
if (tester.test(filename) &&
|
||||||
|
!/\/demo$/.test(path.dirname(filename))) {
|
||||||
|
return {
|
||||||
|
meta: markdownData.meta,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
categoryOrder: {
|
lazyLoad(nodePath, nodeValue) {
|
||||||
十大原则: 0,
|
if (typeof nodeValue === 'string') {
|
||||||
Principles: 0,
|
return true;
|
||||||
设计基础: 1,
|
}
|
||||||
'Design Fundamental': 1,
|
return nodePath.endsWith('/demo');
|
||||||
},
|
},
|
||||||
typeOrder: {
|
pick: {
|
||||||
General: 0,
|
components(markdownData) {
|
||||||
Layout: 1,
|
const filename = markdownData.meta.filename;
|
||||||
Navigation: 2,
|
if (!/^components/.test(filename) ||
|
||||||
'Data Entry': 3,
|
/\/demo$/.test(path.dirname(filename))) return;
|
||||||
'Data Display': 4,
|
|
||||||
Feedback: 5,
|
return {
|
||||||
Localization: 6,
|
meta: markdownData.meta,
|
||||||
Other: 7,
|
};
|
||||||
},
|
},
|
||||||
docVersions: {
|
changelog(markdownData) {
|
||||||
'0.9.x': 'http://09x.ant.design',
|
if (/CHANGELOG/.test(markdownData.meta.filename)) {
|
||||||
'0.10.x': 'http://010x.ant.design',
|
return {
|
||||||
'0.11.x': 'http://011x.ant.design',
|
meta: markdownData.meta,
|
||||||
'0.12.x': 'http://012x.ant.design',
|
};
|
||||||
'1.x': 'http://1x.ant.design',
|
}
|
||||||
},
|
},
|
||||||
|
'docs/pattern': pickerGenerator('pattern'),
|
||||||
|
'docs/practice': pickerGenerator('practice'),
|
||||||
|
'docs/react': pickerGenerator('react'),
|
||||||
|
'docs/resource': pickerGenerator('resource'),
|
||||||
|
'docs/spec': pickerGenerator('spec'),
|
||||||
|
},
|
||||||
|
plugins: [
|
||||||
|
'bisheng-plugin-description',
|
||||||
|
'bisheng-plugin-toc?maxDepth=2&keepElem',
|
||||||
|
'bisheng-plugin-antd',
|
||||||
|
'bisheng-plugin-react?lang=__react',
|
||||||
|
],
|
||||||
routes: {
|
routes: {
|
||||||
path: '/',
|
path: '/',
|
||||||
component: './template/Layout/index',
|
component: './template/Layout/index',
|
||||||
|
@ -4,7 +4,6 @@ import { Row, Col, Menu } from 'antd';
|
|||||||
import Article from './Article';
|
import Article from './Article';
|
||||||
import ComponentDoc from './ComponentDoc';
|
import ComponentDoc from './ComponentDoc';
|
||||||
import * as utils from '../utils';
|
import * as utils from '../utils';
|
||||||
import config from '../../';
|
|
||||||
|
|
||||||
const SubMenu = Menu.SubMenu;
|
const SubMenu = Menu.SubMenu;
|
||||||
|
|
||||||
@ -124,9 +123,10 @@ export default class MainContent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
generateSubMenuItems(obj) {
|
generateSubMenuItems(obj) {
|
||||||
|
const { themeConfig } = this.props;
|
||||||
const topLevel = (obj.topLevel || []).map(this.generateMenuItem.bind(this, true));
|
const topLevel = (obj.topLevel || []).map(this.generateMenuItem.bind(this, true));
|
||||||
const itemGroups = Object.keys(obj).filter(isNotTopLevel)
|
const itemGroups = Object.keys(obj).filter(isNotTopLevel)
|
||||||
.sort((a, b) => config.typeOrder[a] - config.typeOrder[b])
|
.sort((a, b) => themeConfig.typeOrder[a] - themeConfig.typeOrder[b])
|
||||||
.map((type) => {
|
.map((type) => {
|
||||||
const groupItems = obj[type].sort((a, b) => {
|
const groupItems = obj[type].sort((a, b) => {
|
||||||
return a.title.charCodeAt(0) -
|
return a.title.charCodeAt(0) -
|
||||||
@ -142,13 +142,14 @@ export default class MainContent extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getMenuItems() {
|
getMenuItems() {
|
||||||
|
const { themeConfig } = this.props;
|
||||||
const moduleData = getModuleData(this.props);
|
const moduleData = getModuleData(this.props);
|
||||||
const menuItems = utils.getMenuItems(
|
const menuItems = utils.getMenuItems(
|
||||||
moduleData, this.context.intl.locale
|
moduleData, this.context.intl.locale
|
||||||
);
|
);
|
||||||
const topLevel = this.generateSubMenuItems(menuItems.topLevel);
|
const topLevel = this.generateSubMenuItems(menuItems.topLevel);
|
||||||
const subMenu = Object.keys(menuItems).filter(isNotTopLevel)
|
const subMenu = Object.keys(menuItems).filter(isNotTopLevel)
|
||||||
.sort((a, b) => config.categoryOrder[a] - config.categoryOrder[b])
|
.sort((a, b) => themeConfig.categoryOrder[a] - themeConfig.categoryOrder[b])
|
||||||
.map((category) => {
|
.map((category) => {
|
||||||
const subMenuItems = this.generateSubMenuItems(menuItems[category]);
|
const subMenuItems = this.generateSubMenuItems(menuItems[category]);
|
||||||
return (
|
return (
|
||||||
|
@ -3,7 +3,6 @@ import { FormattedMessage, injectIntl } from 'react-intl';
|
|||||||
import { Select, Modal } from 'antd';
|
import { Select, Modal } from 'antd';
|
||||||
import { version as antdVersion } from 'antd/package.json';
|
import { version as antdVersion } from 'antd/package.json';
|
||||||
import * as utils from '../utils';
|
import * as utils from '../utils';
|
||||||
import { docVersions } from '../../';
|
|
||||||
|
|
||||||
const Option = Select.Option;
|
const Option = Select.Option;
|
||||||
|
|
||||||
@ -19,8 +18,6 @@ function isLocalStorageNameSupported() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
docVersions[antdVersion] = antdVersion;
|
|
||||||
|
|
||||||
class Footer extends React.Component {
|
class Footer extends React.Component {
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
// for some iOS
|
// for some iOS
|
||||||
@ -71,6 +68,8 @@ class Footer extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const { themeConfig } = this.props;
|
||||||
|
const docVersions = { ...themeConfig.docVersions, [antdVersion]: antdVersion };
|
||||||
const options = Object.keys(docVersions)
|
const options = Object.keys(docVersions)
|
||||||
.map(version => <Option value={docVersions[version]} key={version}>{version}</Option>);
|
.map(version => <Option value={docVersions[version]} key={version}>{version}</Option>);
|
||||||
return (
|
return (
|
||||||
|
@ -70,7 +70,7 @@ export default class Layout extends React.Component {
|
|||||||
<div className="page-wrapper">
|
<div className="page-wrapper">
|
||||||
<Header {...restProps} isFirstScreen={isFirstScreen} />
|
<Header {...restProps} isFirstScreen={isFirstScreen} />
|
||||||
{cloneElement(children, { onEnterChange: this.onEnterChange })}
|
{cloneElement(children, { onEnterChange: this.onEnterChange })}
|
||||||
<Footer />
|
<Footer {...restProps} />
|
||||||
</div>
|
</div>
|
||||||
</LocaleProvider>
|
</LocaleProvider>
|
||||||
</IntlProvider>
|
</IntlProvider>
|
||||||
|
Loading…
Reference in New Issue
Block a user