diff options
author | obscuren <geffobscura@gmail.com> | 2015-01-09 19:45:09 +0800 |
---|---|---|
committer | obscuren <geffobscura@gmail.com> | 2015-01-09 19:45:09 +0800 |
commit | 012a1c25331385aceb94af2a9829a2c6811d31b7 (patch) | |
tree | 3559aab7bdca4a269167a49802a061f156bfeea5 /cmd/mist/assets/ext/ethereum.js/gulpfile.js | |
parent | 585f259b63db323c87643a235fcbb9dc46d3125f (diff) | |
download | go-tangerine-012a1c25331385aceb94af2a9829a2c6811d31b7.tar.gz go-tangerine-012a1c25331385aceb94af2a9829a2c6811d31b7.tar.zst go-tangerine-012a1c25331385aceb94af2a9829a2c6811d31b7.zip |
Updated ethereum.js
Diffstat (limited to 'cmd/mist/assets/ext/ethereum.js/gulpfile.js')
-rw-r--r-- | cmd/mist/assets/ext/ethereum.js/gulpfile.js | 104 |
1 files changed, 104 insertions, 0 deletions
diff --git a/cmd/mist/assets/ext/ethereum.js/gulpfile.js b/cmd/mist/assets/ext/ethereum.js/gulpfile.js new file mode 100644 index 000000000..b17e50c39 --- /dev/null +++ b/cmd/mist/assets/ext/ethereum.js/gulpfile.js @@ -0,0 +1,104 @@ +#!/usr/bin/env node + +'use strict'; + +var path = require('path'); + +var del = require('del'); +var gulp = require('gulp'); +var browserify = require('browserify'); +var jshint = require('gulp-jshint'); +var uglify = require('gulp-uglify'); +var rename = require('gulp-rename'); +var envify = require('envify/custom'); +var unreach = require('unreachable-branch-transform'); +var source = require('vinyl-source-stream'); +var exorcist = require('exorcist'); +var bower = require('bower'); + +var DEST = './dist/'; + +var build = function(src, dst, ugly) { + var result = 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'); + + if (ugly) { + result = result.transform('uglifyify', { + mangle: false, + compress: { + dead_code: false, + conditionals: true, + unused: false, + hoist_funs: true, + hoist_vars: true, + negate_iife: false + }, + beautify: true, + warnings: true + }); + } + + return result.bundle() + .pipe(exorcist(path.join( DEST, dst + '.js.map'))) + .pipe(source(dst + '.js')) + .pipe(gulp.dest( DEST )); +}; + +var uglifyFile = function(file) { + return gulp.src( DEST + file + '.js') + .pipe(uglify()) + .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('clean', ['lint'], function(cb) { + del([ DEST ], cb); +}); + +gulp.task('lint', function(){ + return gulp.src(['./*.js', './lib/*.js']) + .pipe(jshint()) + .pipe(jshint.reporter('default')); +}); + +gulp.task('build', ['clean'], function () { + return build('index', 'ethereum', true); +}); + +gulp.task('buildDev', ['clean'], function () { + return build('index', 'ethereum', false); +}); + +gulp.task('uglify', ['build'], function(){ + return uglifyFile('ethereum'); +}); + +gulp.task('uglify', ['buildDev'], function(){ + return uglifyFile('ethereum'); +}); + +gulp.task('watch', function() { + gulp.watch(['./lib/*.js'], ['lint', 'prepare', 'build']); +}); + +gulp.task('release', ['bower', 'lint', 'build', 'uglify']); +gulp.task('dev', ['bower', 'lint', 'buildDev', 'uglify']); +gulp.task('default', ['dev']); + |