|
|
@ -18,8 +18,8 @@ var bower = require('bower'); |
|
|
|
|
|
|
|
|
|
|
|
var DEST = './dist/'; |
|
|
|
var DEST = './dist/'; |
|
|
|
|
|
|
|
|
|
|
|
var build = function(src, dst) { |
|
|
|
var build = function(src, dst, ugly) { |
|
|
|
return browserify({ |
|
|
|
var result = browserify({ |
|
|
|
debug: true, |
|
|
|
debug: true, |
|
|
|
insert_global_vars: false, |
|
|
|
insert_global_vars: false, |
|
|
|
detectGlobals: false, |
|
|
|
detectGlobals: false, |
|
|
@ -30,40 +30,25 @@ var build = function(src, dst) { |
|
|
|
.transform('envify', { |
|
|
|
.transform('envify', { |
|
|
|
NODE_ENV: 'build' |
|
|
|
NODE_ENV: 'build' |
|
|
|
}) |
|
|
|
}) |
|
|
|
.transform('unreachable-branch-transform') |
|
|
|
.transform('unreachable-branch-transform'); |
|
|
|
.transform('uglifyify', { |
|
|
|
|
|
|
|
mangle: false, |
|
|
|
if (ugly) { |
|
|
|
compress: { |
|
|
|
result = result.transform('uglifyify', { |
|
|
|
dead_code: false, |
|
|
|
mangle: false, |
|
|
|
conditionals: true, |
|
|
|
compress: { |
|
|
|
unused: false, |
|
|
|
dead_code: false, |
|
|
|
hoist_funs: true, |
|
|
|
conditionals: true, |
|
|
|
hoist_vars: true, |
|
|
|
unused: false, |
|
|
|
negate_iife: false |
|
|
|
hoist_funs: true, |
|
|
|
}, |
|
|
|
hoist_vars: true, |
|
|
|
beautify: true, |
|
|
|
negate_iife: false |
|
|
|
warnings: true |
|
|
|
}, |
|
|
|
}) |
|
|
|
beautify: true, |
|
|
|
.bundle() |
|
|
|
warnings: true |
|
|
|
.pipe(exorcist(path.join( DEST, dst + '.js.map'))) |
|
|
|
}); |
|
|
|
.pipe(source(dst + '.js')) |
|
|
|
} |
|
|
|
.pipe(gulp.dest( DEST )); |
|
|
|
|
|
|
|
}; |
|
|
|
return result.bundle() |
|
|
|
|
|
|
|
|
|
|
|
var buildDev = function(src, dst) { |
|
|
|
|
|
|
|
return browserify({ |
|
|
|
|
|
|
|
debug: true, |
|
|
|
|
|
|
|
insert_global_vars: false, |
|
|
|
|
|
|
|
detectGlobals: false, |
|
|
|
|
|
|
|
bundleExternal: false |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.require('./' + src + '.js', {expose: 'web3'}) |
|
|
|
|
|
|
|
.add('./' + src + '.js') |
|
|
|
|
|
|
|
.transform('envify', { |
|
|
|
|
|
|
|
NODE_ENV: 'build' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
.transform('unreachable-branch-transform') |
|
|
|
|
|
|
|
.bundle() |
|
|
|
|
|
|
|
.pipe(exorcist(path.join( DEST, dst + '.js.map'))) |
|
|
|
.pipe(exorcist(path.join( DEST, dst + '.js.map'))) |
|
|
|
.pipe(source(dst + '.js')) |
|
|
|
.pipe(source(dst + '.js')) |
|
|
|
.pipe(gulp.dest( DEST )); |
|
|
|
.pipe(gulp.dest( DEST )); |
|
|
@ -83,33 +68,29 @@ gulp.task('bower', function(cb){ |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('clean', ['lint'], function(cb) { |
|
|
|
|
|
|
|
del([ DEST ], cb); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('lint', function(){ |
|
|
|
gulp.task('lint', function(){ |
|
|
|
return gulp.src(['./*.js', './lib/*.js']) |
|
|
|
return gulp.src(['./*.js', './lib/*.js']) |
|
|
|
.pipe(jshint()) |
|
|
|
.pipe(jshint()) |
|
|
|
.pipe(jshint.reporter('default')); |
|
|
|
.pipe(jshint.reporter('default')); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('clean', ['lint'], function(cb) { |
|
|
|
|
|
|
|
del([ DEST ], cb); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('build', ['clean'], function () { |
|
|
|
gulp.task('build', ['clean'], function () { |
|
|
|
return build('index', 'ethereum'); |
|
|
|
return build('index', 'ethereum', true); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
gulp.task('buildQt', ['clean'], function () { |
|
|
|
|
|
|
|
return build('index_qt', 'ethereum'); |
|
|
|
|
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('buildDev', ['clean'], function () { |
|
|
|
gulp.task('buildDev', ['clean'], function () { |
|
|
|
return buildDev('index', 'ethereum'); |
|
|
|
return build('index', 'ethereum', false); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('uglify', ['build'], function(){ |
|
|
|
gulp.task('uglify', ['build'], function(){ |
|
|
|
return uglifyFile('ethereum'); |
|
|
|
return uglifyFile('ethereum'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('uglifyQt', ['buildQt'], function () { |
|
|
|
gulp.task('uglify', ['buildDev'], function(){ |
|
|
|
return uglifyFile('ethereum'); |
|
|
|
return uglifyFile('ethereum'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
@ -117,7 +98,7 @@ gulp.task('watch', function() { |
|
|
|
gulp.watch(['./lib/*.js'], ['lint', 'prepare', 'build']); |
|
|
|
gulp.watch(['./lib/*.js'], ['lint', 'prepare', 'build']); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
gulp.task('default', ['bower', 'lint', 'build', 'uglify']); |
|
|
|
gulp.task('release', ['bower', 'lint', 'build', 'uglify']); |
|
|
|
gulp.task('qt', ['bower', 'lint', 'buildQt', 'uglifyQt']); |
|
|
|
gulp.task('dev', ['bower', 'lint', 'buildDev', 'uglify']); |
|
|
|
gulp.task('dev', ['bower', 'lint', 'buildDev']); |
|
|
|
gulp.task('default', ['dev']); |
|
|
|
|
|
|
|
|
|
|
|