2016-03-02 11:57:37 +08:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const fs = require('fs');
|
2016-03-10 15:28:53 +08:00
|
|
|
const path = require('path');
|
2016-03-02 11:57:37 +08:00
|
|
|
const R = require('ramda');
|
|
|
|
const utils = require('./utils');
|
|
|
|
|
2016-03-04 18:06:34 +08:00
|
|
|
module.exports = function buildCommon(dirs, outputFile) {
|
|
|
|
const mds = utils.findMDFile(dirs, true)
|
|
|
|
.filter((file) => !/install_en\.md$/gi.test(file)); // TODO
|
2016-03-02 11:57:37 +08:00
|
|
|
|
2016-03-04 15:19:23 +08:00
|
|
|
let content = 'module.exports = {';
|
2016-03-08 15:35:03 +08:00
|
|
|
mds.forEach((fileName) => {
|
2016-03-10 15:28:53 +08:00
|
|
|
const requirePath = path.relative(path.dirname(outputFile), fileName);
|
|
|
|
content += `\n '${fileName}': require('antd-md!${requirePath}'),`;
|
2016-03-04 15:19:23 +08:00
|
|
|
});
|
|
|
|
content += '\n};';
|
2016-03-02 11:57:37 +08:00
|
|
|
|
2016-03-03 11:12:46 +08:00
|
|
|
fs.writeFile(outputFile, content);
|
2016-03-02 11:57:37 +08:00
|
|
|
};
|