[Doc] sync render doc for search crawler

This commit is contained in:
陈嘉涵
2019-05-29 10:20:22 +08:00
parent fecc82e69b
commit 3bc5a93941
4 changed files with 30 additions and 169 deletions
-27
View File
@@ -1,5 +1,4 @@
const fs = require('fs-extra');
const glob = require('fast-glob');
const path = require('path');
const uppercamelize = require('uppercamelcase');
const Components = require('./get-components')();
@@ -8,8 +7,6 @@ const packageJson = require('../package.json');
const version = process.env.VERSION || packageJson.version;
const tips = `/* eslint-disable */
// This file is auto gererated by build/build-entry.js`;
const root = path.join(__dirname, '../');
const join = dir => path.join(root, dir);
function buildVantEntry() {
const uninstallComponents = [
@@ -78,29 +75,5 @@ export default {
fs.writeFileSync(path.join(dir, '../docs/src/demo-entry.js'), content);
}
// generate webpack entry file for markdown docs
function buildDocsEntry() {
const output = join('docs/src/docs-entry.js');
const getName = fullPath => fullPath.replace(/\/(en|zh)/, '.$1').split('/').pop().replace('.md', '');
const docs = glob
.sync([
join('docs/**/*.md'),
join('packages/**/*.md'),
'!**/node_modules/**'
])
.map(fullPath => {
const name = getName(fullPath);
return `'${name}': () => import('${path.relative(join('docs/src'), fullPath).replace(/\\/g, '/')}')`;
});
const content = `${tips}
export default {
${docs.join(',\n ')}
};
`;
fs.writeFileSync(output, content);
}
buildVantEntry();
buildDemoEntry();
buildDocsEntry();