forked from fabricjs/fabric.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create_build_script.js
56 lines (48 loc) · 1.18 KB
/
create_build_script.js
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
var fs = require('fs'),
execSync = require('execSync').exec;
var modules = [
'text',
'cufon',
'gestures',
'easing',
'parser',
'freedrawing',
'interaction',
'serialization',
'image_filters',
'gradient',
'pattern',
'node'
];
// http://stackoverflow.com/questions/5752002/find-all-possible-subset-combos-in-an-array
var combine = function(a, min) {
var fn = function(n, src, got, all) {
if (n == 0) {
if (got.length > 0) {
all[all.length] = got;
}
return;
}
for (var j = 0, len = src.length; j < len; j++) {
fn(n - 1, src.slice(j + 1), got.concat([src[j]]), all);
}
return;
}
var all = [];
for (var i = min, _len = a.length; i < _len; i++) {
fn(i, a, [], all);
}
all.push(a);
return all;
}
var combinations = combine(modules, 1);
var startTime = new Date;
fs.writeFile('build.sh', '#!/usr/bin/env sh\n\n', function() {
for (var i = 0, len = combinations.length; i < len; i++) {
var modulesStr = combinations[i].join(',');
var command = 'node build.js build-sh modules=' + modulesStr;
execSync(command);
}
// create basic (minimal) build
execSync('node build.js build-sh modules=');
});