mirror of
https://github.com/ant-design/ant-design.git
synced 2025-07-26 00:26:53 +08:00
21 lines
611 B
JavaScript
21 lines
611 B
JavaScript
'use strict';
|
|
|
|
const fs = require('fs');
|
|
const R = require('ramda');
|
|
const utils = require('./utils');
|
|
|
|
module.exports = function buildComponentsList(indexes, outputPath) {
|
|
const componentMetas = R.map((fileName) => {
|
|
const fileContent = utils.parseFileContent(fileName);
|
|
return utils.parseMeta(fileContent);
|
|
}, indexes);
|
|
|
|
const groupByType = R.groupBy(R.compose(R.defaultTo('其它'), R.prop('type')));
|
|
const componentsList = groupByType(componentMetas);
|
|
|
|
const content = 'module.exports = ' +
|
|
JSON.stringify(componentsList, null, 2) + ';';
|
|
|
|
fs.writeFile(outputPath, content);
|
|
};
|