Browse Source

chore: move _site/data to _data

pull/1251/head
Benjy Cui 9 years ago
parent
commit
e62c853a6a
  1. 3
      .gitignore
  2. 4
      scripts/build-demos-list.js
  3. 14
      scripts/build-website.js
  4. 2
      site/component/ComponentDoc/index.jsx
  5. 2
      site/component/Header/index.jsx
  6. 10
      site/entry/index.jsx
  7. 4
      site/entry/utils.js

3
.gitignore

@ -24,4 +24,5 @@ _site
dist
lib
elasticsearch-*
config/base.yaml
config/base.yaml
_data/

4
scripts/build-demos-list.js

@ -19,8 +19,8 @@ module.exports = function buildDemosList(dirs, outputPath) {
let content =
'const React = require("react");\n' +
'const ReactDOM = require("react-dom");\n' +
'const antd = require("../../");\n' +
'const BrowserDemo = require("../../site/component/BrowserDemo");\n' +
'const antd = require("../");\n' +
'const BrowserDemo = require("../site/component/BrowserDemo");\n' +
'module.exports = {';
Object.keys(groupedDemos).forEach((key) => {
content += `\n '${key}': [`;

14
scripts/build-website.js

@ -3,18 +3,18 @@
'use strict';
// Ensure that data directory exist.
require('mkdirp').sync('./_site/data');
require('mkdirp').sync('./_data');
const buildDemosList = require('./build-demos-list');
buildDemosList(['./components', './docs'], './_site/data/demos-list.js');
buildDemosList(['./components', './docs'], './_data/demos-list.js');
const buildCommon = require('./build-common');
buildCommon([
'./components',
'./docs/react',
'./CHANGELOG.md',
], './_site/data/react-components.js');
buildCommon('./docs/practice', './_site/data/practice.js');
buildCommon('./docs/pattern', './_site/data/pattern.js');
buildCommon('./docs/spec', './_site/data/spec.js');
buildCommon('./docs/resource', './_site/data/resource.js');
], './_data/react-components.js');
buildCommon('./docs/practice', './_data/practice.js');
buildCommon('./docs/pattern', './_data/pattern.js');
buildCommon('./docs/spec', './_data/spec.js');
buildCommon('./docs/resource', './_data/resource.js');

2
site/component/ComponentDoc/index.jsx

@ -4,7 +4,7 @@ import classNames from 'classnames';
import { Row, Col, Icon, Affix } from '../../../';
import Demo from '../Demo';
import * as utils from '../utils';
import demosList from '../../../_site/data/demos-list';
import demosList from '../../../_data/demos-list';
export default class ComponentDoc extends React.Component {
constructor(props) {

2
site/component/Header/index.jsx

@ -5,7 +5,7 @@ const Option = Select.Option;
import './index.less';
import componentsList from '../../../_site/data/react-components';
import componentsList from '../../../_data/react-components';
export default class Header extends React.Component {
handleSearch(value) {
this.props.history.push({ pathname: value });

10
site/entry/index.jsx

@ -6,11 +6,11 @@ import * as utils from './utils';
import '../common/lib';
import App from '../component/App';
import Home from '../component/Home';
import practice from '../../_site/data/practice';
import pattern from '../../_site/data/pattern';
import reactComponents from '../../_site/data/react-components';
import spec from '../../_site/data/spec';
import resource from '../../_site/data/resource';
import practice from '../../_data/practice';
import pattern from '../../_data/pattern';
import reactComponents from '../../_data/react-components';
import spec from '../../_data/spec';
import resource from '../../_data/resource';
import config from '../website.config';
// TODO: pack dependencies with atool build

4
site/entry/utils.js

@ -3,11 +3,11 @@ import { IndexRedirect } from 'react-router';
import MainContent from '../component/MainContent';
import Article from '../component/Article';
import ComponentDoc from '../component/ComponentDoc';
import demosList from '../../_site/data/demos-list';
import demosList from '../../_data/demos-list';
import { redirects } from '../website.config';
if (module.hot) {
module.hot.accept('../../_site/data/demos-list', () => {});
module.hot.accept('../../_data/demos-list', () => {});
}
function fileNameToPath(fileName) {

Loading…
Cancel
Save