-
Notifications
You must be signed in to change notification settings - Fork 1
/
make.js
37 lines (34 loc) · 1.09 KB
/
make.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
/* Cbe / make.js
* echo 'make script for Cbe' && node make
* (c) 2015 David (daXXog) Volm ><> + + + <><
* Released under Apache License, Version 2.0:
* http://www.apache.org/licenses/LICENSE-2.0.html
*/
var bitfactory = require('bitfactory'),
UglifyJS = require("uglify-js"),
stoptime = require('stoptime'),
fs = require('fs');
var watch = stoptime(),
header = '';
bitfactory.make({ //routes
"": function(err, results) {
console.log('built Cbe in ' + watch.elapsed() + 'ms.');
}
}, { //dependencies
"*": { //wildcard
"header": function(cb) {
fs.readFile('cbe.h', 'utf8', function(err, data) {
header = data;
cb(err);
});
},
"cbe.min.js": ["header", function(cb) {
fs.writeFileSync('cbe.min.js', header + UglifyJS.minify('cbe.js').code);
cb();
}],
"cli.min.js": ["header", function(cb) {
fs.writeFileSync('cli.min.js', header + UglifyJS.minify('cli.js').code);
cb();
}]
}
});