const gulp = require('gulp')
const browserify = require('browserify')
const source = require('vinyl-source-stream')
const buffer = require('vinyl-buffer')
const uglify = require('gulp-uglify')
const rename = require('gulp-rename')
const sourcemaps = require('gulp-sourcemaps')
const babel = require('gulp-babel')
const concat = require('gulp-concat')

gulp.task('build', ['babel', 'pack', 'uglify'])

gulp.task('babel', () => {
	return gulp.src('./index.js')
		.pipe(sourcemaps.init())
		.pipe(babel({
			presets: ['es2015']
		}))
		.pipe(concat('redux-watcher.js'))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('dist'))
})

gulp.task('pack', () => {
	return browserify({
		entries: 'dist/redux-watcher.js',
		debug: true,
		insertGlobals: true
	}).bundle()
		.pipe(source('redux-watcher.browser.js'))
		.pipe(buffer())
		.pipe(sourcemaps.init({ loadMaps: true }))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('dist'))
})

gulp.task('uglify', () => {
	return gulp.src('dist/redux-watcher.browser.js')
		.pipe(sourcemaps.init({ loadMaps: true }))
		.pipe(uglify())
		.pipe(rename({
			suffix: '.min'
		}))
		.pipe(sourcemaps.write('.'))
		.pipe(gulp.dest('dist'))
})

@@ -349,57 +349,8 @@
 ')%0A%0A
-gulp.task('build', %5B'babel', 'pack', 'uglify'%5D)%0A%0A
 gulp
@@ -590,16 +590,27 @@
 ('pack',
+ %5B'babel'%5D,
  () =%3E %7B
@@ -897,23 +897,32 @@
 p.task('
-uglify'
+build', %5B'pack'%5D
 , () =%3E 

fix task sequence