-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.js
43 lines (31 loc) · 1009 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
38
39
40
'use strict';
var browserify = require('browserify');
var fs = require('fs');
var UglifyJS = require('uglify-js');
var bundle1 = fs.createWriteStream('./build/bundle1.js');
var bundle = './build/bundle.js';
var includes = [
'lib/crypto/includes/browser/forge.min.js',
'lib/crypto/includes/browser/jsbn.js',
'lib/crypto/includes/browser/jsbn2.js',
'lib/crypto/includes/browser/ec.js',
'lib/crypto/includes/browser/sec.js',
'lib/crypto/includes/browser/prng4.js',
'lib/crypto/includes/browser/rng.js',
'build/bundle1.js',
'lib/webrtc.js',
'seeds.js'
];
var b = browserify();
b.add('./thjs.js');
b.bundle().pipe(bundle1);
bundle1.on('finish', function () {
fs.truncateSync(bundle, 0);
fs.truncateSync('./examples/browser/js/bundle.js', 0);
var data = UglifyJS.minify(includes);
// temp hack
data.code = data.code.replace('"use strict";','');
fs.appendFileSync(bundle, data.code);
fs.appendFileSync('./examples/browser/js/bundle.js', data.code);
fs.unlink('./build/bundle1.js');
});