|
|
|
@ -16,27 +16,9 @@ var source = require('vinyl-source-stream'); |
|
|
|
|
var exorcist = require('exorcist'); |
|
|
|
|
var bower = require('bower'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var DEST = './dist/'; |
|
|
|
|
|
|
|
|
|
gulp.task('bower', function(cb){ |
|
|
|
|
bower.commands.install().on('end', function (installed){ |
|
|
|
|
console.log(installed); |
|
|
|
|
cb(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('lint', function(){ |
|
|
|
|
return gulp.src(['./*.js', './lib/*.js']) |
|
|
|
|
.pipe(jshint()) |
|
|
|
|
.pipe(jshint.reporter('default')); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('clean', ['lint'], function(cb) { |
|
|
|
|
del([ DEST ], cb); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('build', ['clean'], function () { |
|
|
|
|
var build = function(src, dst) { |
|
|
|
|
return browserify({ |
|
|
|
|
debug: true, |
|
|
|
|
insert_global_vars: false, |
|
|
|
@ -44,7 +26,7 @@ gulp.task('build', ['clean'], function () { |
|
|
|
|
bundleExternal: false |
|
|
|
|
}) |
|
|
|
|
.add('./') |
|
|
|
|
.require('./index.js', {expose: 'web3'}) |
|
|
|
|
.require('./' + src + '.js', {expose: 'web3'}) |
|
|
|
|
.transform('envify', { |
|
|
|
|
NODE_ENV: 'build' |
|
|
|
|
}) |
|
|
|
@ -63,16 +45,49 @@ gulp.task('build', ['clean'], function () { |
|
|
|
|
warnings: true, |
|
|
|
|
}) |
|
|
|
|
.bundle() |
|
|
|
|
.pipe(exorcist(path.join( DEST, 'ethereum.js.map'))) |
|
|
|
|
.pipe(source('ethereum.js')) |
|
|
|
|
.pipe(exorcist(path.join( DEST, dst + '.js.map'))) |
|
|
|
|
.pipe(source(dst + '.js')) |
|
|
|
|
.pipe(gulp.dest( DEST )); |
|
|
|
|
}); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
gulp.task('uglify', ['build'], function(){ |
|
|
|
|
return gulp.src( DEST + 'ethereum.js') |
|
|
|
|
var uglifyFile = function(file) { |
|
|
|
|
return gulp.src( DEST + file + '.js') |
|
|
|
|
.pipe(uglify()) |
|
|
|
|
.pipe(rename('ethereum.min.js')) |
|
|
|
|
.pipe(rename(file + '.min.js')) |
|
|
|
|
.pipe(gulp.dest( DEST )); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
gulp.task('bower', function(cb){ |
|
|
|
|
bower.commands.install().on('end', function (installed){ |
|
|
|
|
console.log(installed); |
|
|
|
|
cb(); |
|
|
|
|
}); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('lint', function(){ |
|
|
|
|
return gulp.src(['./*.js', './lib/*.js']) |
|
|
|
|
.pipe(jshint()) |
|
|
|
|
.pipe(jshint.reporter('default')); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('clean', ['lint'], function(cb) { |
|
|
|
|
del([ DEST ], cb); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('build', ['clean'], function () { |
|
|
|
|
return build('index', 'ethereum'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('buildQt', ['clean'], function () { |
|
|
|
|
return build('index_qt', 'ethereum_qt'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('uglify', ['build'], function(){ |
|
|
|
|
return uglifyFile('ethereum'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('uglifyQt', ['buildQt'], function () { |
|
|
|
|
return uglifyFile('ethereum_qt'); |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('watch', function() { |
|
|
|
@ -80,3 +95,4 @@ gulp.task('watch', function() { |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
gulp.task('default', ['bower', 'lint', 'build', 'uglify']); |
|
|
|
|
gulp.task('qt', ['bower', 'lint', 'buildQt', 'uglifyQt']); |
|
|
|
|