summaryrefslogtreecommitdiff
path: root/support
diff options
context:
space:
mode:
authorGraeme Yeates <yeatesgraeme@gmail.com>2016-01-04 10:38:20 -0500
committerGraeme Yeates <yeatesgraeme@gmail.com>2016-01-04 10:38:20 -0500
commit41489b2d8ed5c1677fd77975cecd54b4f60f4334 (patch)
tree2b50cddb64dbca80159693438b8d1a193d7dc43e /support
parent85f5be9ccbd1055178d14162916d9757303d468c (diff)
downloadasync-41489b2d8ed5c1677fd77975cecd54b4f60f4334.tar.gz
Update make build tasks
Diffstat (limited to 'support')
-rw-r--r--support/build/aggregate-build.js20
-rw-r--r--support/build/aggregate-bundle.js9
-rw-r--r--support/build/aggregate-cjs.js9
-rw-r--r--support/build/compile-modules.js34
-rw-r--r--support/build/modules-cjs.js3
-rw-r--r--support/build/plugin-lodash-import-rename.js22
-rw-r--r--support/dependencies.json262
7 files changed, 97 insertions, 262 deletions
diff --git a/support/build/aggregate-build.js b/support/build/aggregate-build.js
new file mode 100644
index 0000000..63d7799
--- /dev/null
+++ b/support/build/aggregate-build.js
@@ -0,0 +1,20 @@
+import compileModules from './compile-modules';
+import rollup from 'rollup';
+import rimraf from 'rimraf/rimraf';
+
+export default function buildBundle(options) {
+ function bundle() {
+ rollup.rollup({
+ entry: options.outpath + '/index.js'
+ }).then(function ( bundle ) {
+ bundle.write({
+ format: options.format,
+ moduleName: 'async',
+ dest: options.outfile
+ });
+ rimraf.sync(options.outpath);
+ });
+ }
+
+ compileModules(bundle, options);
+}
diff --git a/support/build/aggregate-bundle.js b/support/build/aggregate-bundle.js
new file mode 100644
index 0000000..5e6e005
--- /dev/null
+++ b/support/build/aggregate-bundle.js
@@ -0,0 +1,9 @@
+import aggregateBuild from './aggregate-build';
+
+aggregateBuild({
+ es6: true,
+ outpath:'build/build-modules-es6',
+ outfile: 'build/async-bundle.js',
+ format: 'umd',
+ lodashRename: true
+}); \ No newline at end of file
diff --git a/support/build/aggregate-cjs.js b/support/build/aggregate-cjs.js
new file mode 100644
index 0000000..f27b6bf
--- /dev/null
+++ b/support/build/aggregate-cjs.js
@@ -0,0 +1,9 @@
+import aggregateBuild from './aggregate-build';
+
+aggregateBuild({
+ es6: true,
+ outpath:'build/build-modules-es6',
+ outfile: 'build/async-cjs.js',
+ format: 'cjs',
+ lodashRename: false
+});
diff --git a/support/build/compile-modules.js b/support/build/compile-modules.js
new file mode 100644
index 0000000..17d34ec
--- /dev/null
+++ b/support/build/compile-modules.js
@@ -0,0 +1,34 @@
+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 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/modules', es6: false, lodashRename: false});
+ let plugins = [];
+
+ if (options.lodashRename) {
+ plugins.push(pluginLodashImportRename);
+ }
+ if (!options.es6) {
+ plugins.push(pluginCJS);
+ }
+
+ readdirR(options.path, [], function(err, files) {
+ fs.emptyDirSync(options.outpath);
+ fs.emptyDirSync(joinPath(options.outpath, 'internal'));
+ async.each(files, (file, callback) => {
+ var filename = file.startsWith(options.path) ? file.slice(options.path.length) : file;
+ transformFile(file, {
+ babelrc: false,
+ plugins: plugins
+ }, function(err, content) {
+ fs.writeFile(joinPath(options.outpath, filename), content.code, callback);
+ });
+ }, cb);
+ });
+}
diff --git a/support/build/modules-cjs.js b/support/build/modules-cjs.js
new file mode 100644
index 0000000..09632ff
--- /dev/null
+++ b/support/build/modules-cjs.js
@@ -0,0 +1,3 @@
+import compileModules from './compile-modules';
+
+compileModules(function() {}, {es6: false});
diff --git a/support/build/plugin-lodash-import-rename.js b/support/build/plugin-lodash-import-rename.js
new file mode 100644
index 0000000..cb765fa
--- /dev/null
+++ b/support/build/plugin-lodash-import-rename.js
@@ -0,0 +1,22 @@
+import _ from 'lodash';
+import {dirname, sep} from 'path';
+
+export default function() {
+ return {
+ visitor: {
+
+ ImportDeclaration(path, mapping) {
+ let {node} = path;
+ let {value} = node.source;
+
+ if (/\blodash\b/.test(value)) {
+ let f = mapping.file.opts.filename;
+ let dir = dirname(f).split(sep);
+ let relative = _.repeat('../', dir.length + 1);
+
+ node.source.value = value.replace(/\blodash\b/, relative + 'deps/lodash-es');
+ }
+ }
+ }
+ };
+}
diff --git a/support/dependencies.json b/support/dependencies.json
deleted file mode 100644
index 2388eb4..0000000
--- a/support/dependencies.json
+++ /dev/null
@@ -1,262 +0,0 @@
-{
- "apply": {
- "async.util.restparam": "<%=version%>"
- },
- "applyeach": {
- "async.eachof": "<%=version%>",
- "async.util.applyeach": "<%=version%>"
- },
- "applyeachseries": {
- "async.eachofseries": "<%=version%>",
- "async.util.applyeach": "<%=version%>"
- },
- "asyncify": {
- "async.util.asyncify": "<%=version%>"
- },
- "auto": {
- "async.util.arrayeach": "<%=version%>",
- "async.util.foreachof": "<%=version%>",
- "async.util.indexof": "<%=version%>",
- "async.util.isarray": "<%=version%>",
- "async.util.keys": "<%=version%>",
- "async.util.noop": "<%=version%>",
- "async.util.once": "<%=version%>",
- "async.util.reduce": "<%=version%>",
- "async.util.restparam": "<%=version%>",
- "async.util.setimmediate": "<%=version%>"
- },
- "cargo": {
- "async.util.queue": "<%=version%>"
- },
- "compose": {
- "async.seq": "<%=version%>"
- },
- "concat": {
- "async.util.concat": "<%=version%>",
- "async.util.doparallel": "<%=version%>"
- },
- "concatseries": {
- "async.util.concat": "<%=version%>",
- "async.util.doseries": "<%=version%>"
- },
- "constant": {
- "async.util.restparam": "<%=version%>"
- },
- "detect": {
- "async.eachof": "<%=version%>",
- "async.util.createtester": "<%=version%>",
- "async.util.findgetresult": "<%=version%>",
- "async.util.identity": "<%=version%>"
- },
- "detectlimit": {
- "async.eachoflimit": "<%=version%>",
- "async.util.createtester": "<%=version%>",
- "async.util.findgetresult": "<%=version%>",
- "async.util.identity": "<%=version%>"
- },
- "detectseries": {
- "async.eachofseries": "<%=version%>",
- "async.util.createtester": "<%=version%>",
- "async.util.findgetresult": "<%=version%>",
- "async.util.identity": "<%=version%>"
- },
- "dir": {
- "async.util.consolefn": "<%=version%>"
- },
- "doduring": {
- "async.during": "<%=version%>"
- },
- "dountil": {
- "async.dowhilst": "<%=version%>"
- },
- "dowhilst": {
- "async.whilst": "<%=version%>"
- },
- "during": {
- "async.util.noop": "<%=version%>",
- "async.util.restparam": "<%=version%>"
- },
- "each": {
- "async.eachof": "<%=version%>",
- "async.util.withoutindex": "<%=version%>"
- },
- "eachlimit": {
- "async.util.eachoflimit": "<%=version%>",
- "async.util.withoutindex": "<%=version%>"
- },
- "eachof": {
- "async.util.keyiterator": "<%=version%>",
- "async.util.noop": "<%=version%>",
- "async.util.once": "<%=version%>",
- "async.util.onlyonce": "<%=version%>"
- },
- "eachoflimit": {
- "async.util.eachoflimit": "<%=version%>"
- },
- "eachofseries": {
- "async.util.keyiterator": "<%=version%>",
- "async.util.noop": "<%=version%>",
- "async.util.once": "<%=version%>",
- "async.util.onlyonce": "<%=version%>",
- "async.util.setimmediate": "<%=version%>"
- },
- "eachseries": {
- "async.eachofseries": "<%=version%>",
- "async.util.withoutindex": "<%=version%>"
- },
- "ensureasync": {
- "async.util.ensureasync": "<%=version%>"
- },
- "every": {
- "async.eachof": "<%=version%>",
- "async.util.createtester": "<%=version%>",
- "async.util.notid": "<%=version%>"
- },
- "everylimit": {
- "async.eachoflimit": "<%=version%>",
- "async.util.createtester": "<%=version%>",
- "async.util.notid": "<%=version%>"
- },
- "filter": {
- "async.util.doparallel": "<%=version%>",
- "async.util.filter": "<%=version%>"
- },
- "filterlimit": {
- "async.util.doparallellimit": "<%=version%>",
- "async.util.filter": "<%=version%>"
- },
- "filterseries": {
- "async.util.doseries": "<%=version%>",
- "async.util.filter": "<%=version%>"
- },
- "forever": {
- "async.util.ensureasync": "<%=version%>",
- "async.util.noop": "<%=version%>",
- "async.util.onlyonce": "<%=version%>"
- },
- "iterator": {},
- "log": {
- "async.util.consolefn": "<%=version%>"
- },
- "map": {
- "async.util.doparallel": "<%=version%>",
- "async.util.mapasync": "<%=version%>"
- },
- "maplimit": {
- "async.util.doparallellimit": "<%=version%>",
- "async.util.mapasync": "<%=version%>"
- },
- "mapseries": {
- "async.util.doseries": "<%=version%>",
- "async.util.mapasync": "<%=version%>"
- },
- "memoize": {
- "async.util.identity": "<%=version%>",
- "async.util.restparam": "<%=version%>",
- "async.util.setimmediate": "<%=version%>"
- },
- "nexttick": {
- "async.util.nexttick": "<%=version%>"
- },
- "parallel": {
- "async.eachof": "<%=version%>",
- "async.util.parallel": "<%=version%>"
- },
- "parallellimit": {
- "async.util.eachoflimit": "<%=version%>",
- "async.util.parallel": "<%=version%>"
- },
- "priorityqueue": {
- "async.queue": "<%=version%>",
- "async.util.arrayeach": "<%=version%>",
- "async.util.isarray": "<%=version%>",
- "async.util.noop": "<%=version%>",
- "async.util.setimmediate": "<%=version%>"
- },
- "queue": {
- "async.util.queue": "<%=version%>"
- },
- "reduce": {
- "async.eachofseries": "<%=version%>"
- },
- "reduceright": {
- "async.reduce": "<%=version%>",
- "async.util.identity": "<%=version%>",
- "async.util.map": "<%=version%>"
- },
- "reject": {
- "async.util.doparallel": "<%=version%>",
- "async.util.reject": "<%=version%>"
- },
- "rejectlimit": {
- "async.util.doparallellimit": "<%=version%>",
- "async.util.reject": "<%=version%>"
- },
- "rejectseries": {
- "async.util.doseries": "<%=version%>",
- "async.util.reject": "<%=version%>"
- },
- "retry": {
- "async.series": "<%=version%>"
- },
- "seq": {
- "async.reduce": "<%=version%>",
- "async.util.noop": "<%=version%>",
- "async.util.restparam": "<%=version%>"
- },
- "series": {
- "async.eachofseries": "<%=version%>",
- "async.util.parallel": "<%=version%>"
- },
- "setimmediate": {
- "async.util.setimmediate": "<%=version%>"
- },
- "some": {
- "async.eachof": "<%=version%>",
- "async.util.createtester": "<%=version%>",
- "async.util.identity": "<%=version%>",
- "async.util.tobool": "<%=version%>"
- },
- "somelimit": {
- "async.eachoflimit": "<%=version%>",
- "async.util.createtester": "<%=version%>",
- "async.util.identity": "<%=version%>",
- "async.util.tobool": "<%=version%>"
- },
- "sortby": {
- "async.map": "<%=version%>",
- "async.util.map": "<%=version%>"
- },
- "times": {
- "async.map": "<%=version%>",
- "async.util.times": "<%=version%>"
- },
- "timeslimit": {
- "async.maplimit": "<%=version%>",
- "async.util.range": "<%=version%>"
- },
- "timesseries": {
- "async.mapseries": "<%=version%>",
- "async.util.times": "<%=version%>"
- },
- "transform": {
- "async.eachof": "<%=version%>",
- "async.util.isarray": "<%=version%>"
- },
- "unmemoize": {},
- "until": {
- "async.whilst": "<%=version%>"
- },
- "waterfall": {
- "async.iterator": "<%=version%>",
- "async.util.ensureasync": "<%=version%>",
- "async.util.isarray": "<%=version%>",
- "async.util.noop": "<%=version%>",
- "async.util.once": "<%=version%>",
- "async.util.restparam": "<%=version%>"
- },
- "whilst": {
- "async.util.noop": "<%=version%>",
- "async.util.restparam": "<%=version%>"
- }
-}