'use strict';

var gulp = require('gulp');
var browserify = require('browserify');
var source = require('vinyl-source-stream');
var streamify = require('gulp-streamify');
var size = require('gulp-size');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var del = require('del');

var config = {
  src: {
    js: {
      all: './src/**/*.js',
      main: './index.js',
      watch: './**/*.js',
      output: 'app.built.js',
      min: 'app.built.min.js'
    }
  },
  options: {
    standalone: 'creditCardType'
  },
  dist: {js: 'dist/js'}
};

function js() {
  return browserify(config.src.js.main, config.options)
    .bundle()
    .pipe(source(config.src.js.output))
    .pipe(streamify(size()))
    .pipe(gulp.dest(config.dist.js))
    .pipe(streamify(uglify()))
    .pipe(streamify(size()))
    .pipe(rename(config.src.js.min))
    .pipe(gulp.dest(config.dist.js));
}

function watch() {
  return gulp.series(js, function watchJS() {
    gulp.watch(config.src.js.watch, js);
  });
}

function clean() {
  return del([config.dist.js]);
}

function build() {
  return gulp.series(clean, js);
}

exports.js = js();
exports.watch = watch();
exports.clean = clean();
exports.build = build();

@@ -342,76 +342,22 @@
     
-all: './src/**/*.js',%0A      main: './index.js',%0A      watch: './**/*
+main: './index
 .js'
@@ -842,123 +842,8 @@
 %0A%7D%0A%0A
-function watch() %7B%0A  return gulp.series(js, function watchJS() %7B%0A    gulp.watch(config.src.js.watch, js);%0A  %7D);%0A%7D%0A%0A
 func
@@ -970,33 +970,8 @@
 ();%0A
-exports.watch = watch();%0A
 expo

Remove unused watch command