-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.js
37 lines (30 loc) · 909 Bytes
/
build.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
var browserify = require('browserify');
var fs = require('fs-extra');
fs.removeSync('./dist/samples');
fs.mkdirsSync('./dist/samples');
fs.copySync('./samples', './dist/samples');
var pipesPending = 0;
pipesPending++;
var t1 = browserify()
.require('malbolge-vm', {expose: 'malbolge-vm'})
.bundle();
t1.on('end', function(){
console.log('[+] Done building vm.js');
checkFinished();
});
t1.pipe(fs.createWriteStream('./dist/js/vm.js'));
pipesPending++;
var t2 = browserify()
.require('./lib/gen-linear.js', {expose: 'gen-linear'})
.require('./lib/gen-bor.js', {expose: 'gen-bor'})
.require('./lib/gen-fixed.js', {expose: 'gen-fixed'})
.bundle();
t2.on('end', function(){
console.log('[+] Done building generators.js');
checkFinished();
});
t2.pipe(fs.createWriteStream('./dist/js/generators.js'));
function checkFinished() {
if (--pipesPending) return;
console.log('Build finished.');
}