var browserify = require('browserify');
var connect = require('gulp-connect');
var merge = require('merge-stream');
var notify = require('gulp-notify');
var gulp = require('gulp');
var gulpif = require('gulp-if');
var gutil = require('gulp-util');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var uglify = require('gulp-uglify');
var watchify = require('watchify');

var files = {
  dependencies: [
    'react',
    'react-dom',
  ],

  browserify: [
    './demo/main.js',
  ],
};

var browserifyTask = function (options) {

  var bundler = browserify({
    entries: [options.src],
    transform: [
      ['babelify', {
        presets: ['es2015', 'stage-2', 'react'],
        plugins: ['transform-class-properties'],
      }],
    ],
    debug: options.development,
    cache: {}, // Requirement of watchify
    packageCache: {}, // Requirement of watchify
    fullPaths: options.development,
    extensions: ['.js', '.jsx', '.json'],
  });

  var rebundle = function () {
    var start = Date.now();
    console.log('Building APP bundle');
    return bundler
      .bundle()
      .on('error', gutil.log)
      .pipe(source(options.output))
      .pipe(gulpif(!options.development, streamify(uglify())))
      .pipe(gulp.dest(options.dest))
      .pipe(gulpif(options.development, connect.reload()))
      .pipe(notify(function () {
        console.log('APP bundle built in ' + (Date.now() - start) + 'ms');
      }));
  };

  bundler.external(files.dependencies);

  if (options.development) {
    bundler = watchify(bundler);
    bundler.on('update', rebundle);
  }

  return rebundle();

};

var browserifyDepsTask = function (options) {

  var vendorsBundler = browserify({
    debug: options.development,
    require: files.dependencies,
  });

  var start = new Date();
  console.log('Building VENDORS bundle');
  return vendorsBundler
    .bundle()
    .on('error', gutil.log)
    .pipe(source(options.output))
    .pipe(gulpif(!options.development, streamify(uglify())))
    .on('error', gutil.log)
    .pipe(gulp.dest(options.dest))
    .pipe(notify(function () {
      console.log('VENDORS bundle built in ' + (Date.now() - start) + 'ms');
    }));

};

gulp.task('deploy', function () {

  var browserifyDepsOpt = {
    development: false,
    src: files.dependencies,
    output: 'vendors.js',
    dest: './dist/scripts',
  };

  var browserifyOpt = {
    development: false,
    src: files.browserify,
    output: 'bundle.js',
    dest: './dist/scripts',
  };

  return merge(
    browserifyDepsTask(browserifyDepsOpt),
    browserifyTask(browserifyOpt)
  );

});

gulp.task('demo', function() {

  var browserifyDepsOpt = {
    development: true,
    src: files.dependencies,
    output: 'vendors.js',
    dest: './demo/build/scripts',
  };

  var browserifyOpt = {
    development: true,
    src: files.browserify,
    output: 'bundle.js',
    dest: './demo/build/scripts',
  };

  var serverOpt = {
    root: './demo/build',
    port: 8889,
    livereload: true,
  };

  connect.server(serverOpt);

  return merge(
    browserifyDepsTask(browserifyDepsOpt),
    browserifyTask(browserifyOpt)
  );

});
@@ -494,20 +494,21 @@
 %0A    './
-demo
+build
 /main.js
@@ -2207,422 +2207,8 @@
 %7D;%0A%0A
-gulp.task('deploy', function () %7B%0A%0A  var browserifyDepsOpt = %7B%0A    development: false,%0A    src: files.dependencies,%0A    output: 'vendors.js',%0A    dest: './dist/scripts',%0A  %7D;%0A%0A  var browserifyOpt = %7B%0A    development: false,%0A    src: files.browserify,%0A    output: 'bundle.js',%0A    dest: './dist/scripts',%0A  %7D;%0A%0A  return merge(%0A    browserifyDepsTask(browserifyDepsOpt),%0A    browserifyTask(browserifyOpt)%0A  );%0A%0A%7D);%0A%0A
 gulp
@@ -2230,24 +2230,24 @@
 unction() %7B%0A
+
 %0A  var brows
@@ -2346,37 +2346,32 @@
 ',%0A    dest: './
-demo/
 build/scripts',%0A
@@ -2484,29 +2484,24 @@
    dest: './
-demo/
 build/script
@@ -2526,24 +2526,24 @@
 rverOpt = %7B%0A
+
     root: '.
@@ -2547,13 +2547,8 @@
  './
-demo/
 buil

Change demo folder to build