all.js 877 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. let _ = require('lodash');
  3. let path = require('path');
  4. let cdn = require('./cdn');
  5. let node = require('./node');
  6. let browser = require('./browser');
  7. function newBuildDirectory(dir, subdir) {
  8. const build = path.join(dir.build, subdir);
  9. return { build: build };
  10. }
  11. module.exports = function(commander, dir) {
  12. let data = {};
  13. _.each(['cdn', 'node', 'browser'], function(target) {
  14. const newDirectory = newBuildDirectory(dir, target),
  15. directory = _.defaults(newDirectory, dir),
  16. options = _.defaults({ target: target }, commander);
  17. data[target] = {
  18. directory: directory,
  19. commander: options
  20. };
  21. });
  22. return [].concat(
  23. cdn(data.cdn.commander, data.cdn.directory),
  24. node(data.node.commander, data.node.directory),
  25. browser(data.browser.commander, data.browser.directory)
  26. );
  27. };