diff options
author | Alex Early <alexander.early@gmail.com> | 2017-04-25 17:04:06 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-25 17:04:06 -0700 |
commit | 9be2370c6fe50abe0e7fd55174ca37187393a9cf (patch) | |
tree | 404a9b13f5676a9a6dfab3d6e469cdfaa724067f /support/build/compile-modules.js | |
parent | dd7cf796310d2a9ad8fa4ce1bf8ec976497bf8cd (diff) | |
parent | 90e4dc37fa05685e85bf50e38e895214e7e4a971 (diff) | |
download | async-9be2370c6fe50abe0e7fd55174ca37187393a9cf.tar.gz |
Merge pull request #1405 from caolan/build-refactor
Build Refactor
Diffstat (limited to 'support/build/compile-modules.js')
-rw-r--r-- | support/build/compile-modules.js | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/support/build/compile-modules.js b/support/build/compile-modules.js deleted file mode 100644 index 16aa1ca..0000000 --- a/support/build/compile-modules.js +++ /dev/null @@ -1,45 +0,0 @@ -import async from '../../lib'; -import {transformFile} from 'babel-core'; -import _ from 'lodash'; -import readdirR from 'recursive-readdir'; -import pluginCJS from 'babel-plugin-transform-es2015-modules-commonjs'; -import pluginModuleExports from 'babel-plugin-add-module-exports'; -import pluginLodashImportRename from './plugin-lodash-import-rename'; -import {join as joinPath} from 'path'; -import fs from 'fs-extra'; - -export default function(cb, options) { - options = _.defaults({}, options, { - path:'lib/', - outpath:'build', - es6: false, - lodashRename: false - }); - let plugins = []; - - if (options.lodashRename) { - plugins.push(pluginLodashImportRename); - } - if (!options.es6) { - plugins.push(pluginModuleExports); - plugins.push(pluginCJS); - } - - readdirR(options.path, [], function(err, files) { - fs.emptyDirSync(options.outpath); - fs.emptyDirSync(joinPath(options.outpath, 'internal')); - async.each(files, (file, callback) => { - let filename = file.startsWith(options.path) ? - file.slice(options.path.length) : - file; - - transformFile(file, { - babelrc: false, - plugins: plugins - }, function(err, content) { - let outpath = joinPath(options.outpath, filename); - fs.writeFile(outpath, content.code, callback); - }); - }, cb); - }); -} |