ant-design/scripts/build-common.js

21 lines
589 B
JavaScript
Raw Normal View History

2016-03-02 11:57:37 +08:00
'use strict';
const fs = require('fs');
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) => {
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
};