forked from ethereumjs/browser-builds
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.js
More file actions
42 lines (33 loc) · 1.1 KB
/
build.js
File metadata and controls
42 lines (33 loc) · 1.1 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
var fs = require("fs")
var browserify = require("browserify")
const srcDir = 'src/'
const buildDir = 'dist/'
const standaloneName = 'ethereumjs'
const packages = [
'ethereumjs-vm',
'ethereumjs-tx',
'ethereumjs-icap',
'ethereumjs-wallet',
'ethereumjs-abi'
]
packages.forEach(function(name) {
console.log('Running browserify for package ' + name + '...')
var version = require('./node_modules/' + name + '/package.json').version
var baseOutPath = buildDir + name + '/' + name + '-' + version
console.log("Creating debug version package...")
var bundleFs = fs.createWriteStream(baseOutPath + '.js')
browserify(srcDir + name + '.js', {
standalone: standaloneName,
debug: true
}).transform("babelify", {presets: ["es2015", "react"]})
.bundle()
.pipe(bundleFs)
console.log("Creating minified package...")
bundleFs = fs.createWriteStream(baseOutPath + '.min.js')
browserify(srcDir + name + '.js', {
standalone: standaloneName,
}).transform("babelify", {presets: ["es2015", "react"]})
.transform('uglifyify', { global: true })
.bundle()
.pipe(bundleFs)
})