mirror of
https://github.com/ant-design/ant-design.git
synced 2025-07-26 00:26:53 +08:00
27 lines
794 B
JavaScript
27 lines
794 B
JavaScript
'use strict';
|
|
|
|
const fs = require('fs');
|
|
const R = require('ramda');
|
|
const utils = require('./utils');
|
|
|
|
const isMeta = R.complement(R.propEq('type', 'hr'));
|
|
const isDescription = R.complement(R.propEq('children', 'API'));
|
|
module.exports = function buildDocsList(indexes, outputPath) {
|
|
const indexesList = R.map((fileName) => {
|
|
const fileContent = utils.parseFileContent(fileName);
|
|
const meta = utils.parseMeta(fileContent);
|
|
const description = R.tail(R.dropWhile(
|
|
isMeta,
|
|
R.takeWhile(isDescription, fileContent)
|
|
));
|
|
const api = R.dropWhile(isDescription, fileContent);
|
|
|
|
return { meta, description, api };
|
|
}, indexes);
|
|
|
|
const content = 'module.exports = ' +
|
|
JSON.stringify(indexesList, null, 2) + ';';
|
|
|
|
fs.writeFile(outputPath, content);
|
|
};
|