-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBrocfile.js
More file actions
66 lines (51 loc) · 1.85 KB
/
Brocfile.js
File metadata and controls
66 lines (51 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
var path = require('path');
var chalk = require('chalk');
var dist = require('broccoli-dist-es6-module');
var funnel = require('broccoli-funnel');
var merge = require('broccoli-merge-trees');
var plugins = require('./index');
var camelCase = require('./tests/utils').camelCase;
function makeTree(plugin) {
var name = plugin.name;
var author = plugin.author;
var packageName = 'd3/plugins/' + author + '/' + name;
var globalName = 'd3.plugins.' + camelCase(author) + '.' + camelCase(name);
var pluginBasePath = path.join('vendor', author, name);
var srcTree = funnel(pluginBasePath, {
srcDir: '/',
include: [ '*.js', 'LICENSE' ]
});
var es6Tree = funnel(srcTree, {
srcDir: '/',
include: [ '*.js', 'LICENSE' ],
destDir: 'es6'
});
var distTree = dist(srcTree, {
// the entry script, and module that becomes the global
main: 'index',
// will become window.ic.ajax with the exports from `main`
global: globalName,
// the prefix for named-amd modules
packageName: packageName,
// global output only: naive shimming, when the id 'ember' is imported,
// substitute with `window.Ember` instead
shim: { 'd3': 'd3' }
});
return funnel(merge([ es6Tree, distTree ]), {
destDir: path.join(author, name)
});
};
module.exports = merge([].concat(plugins.map(function (plugin) {
var prefix = ' ' + chalk.green('ok') + ' ';
var name = plugin.name;
var author = plugin.author;
var packageName = 'd3/plugins/' + author + '/' + name;
var globalName = 'd3.plugins.' + camelCase(author) + '.' + camelCase(name);
console.log(chalk.underline(author + '/' + name));
console.log(prefix + 'es6');
console.log(prefix + 'cjs');
console.log(prefix + 'anonymous-amd');
console.log(prefix + 'named-amd -> ' + packageName);
console.log(prefix + 'global -> ' + globalName);
return makeTree(plugin);
})));