<commit_before>argv = require('yargs').argv
assign = require 'lodash.assign'
autoprefixer = require 'gulp-autoprefixer'
browserify = require 'browserify'
buffer = require 'vinyl-buffer'
coffee = require 'gulp-coffee'
concat = require 'gulp-concat'
connect = require 'gulp-connect'
gulp = require 'gulp'
gutil = require 'gulp-util'
gulpif = require 'gulp-if'
minifycss = require 'gulp-minify-css'
sass = require 'gulp-sass'
source = require 'vinyl-source-stream'
sourcemaps = require 'gulp-sourcemaps'
reactify = require 'reactify'
uglify = require 'gulp-uglify'
usemin = require 'gulp-usemin'
watchify = require 'watchify'

gulp.task 'coffee', ->
  gulp.src ['./app/**/*.coffee']
    .pipe sourcemaps.init()
      .pipe coffee({ bare: true }).on('error', gutil.log)
      .pipe uglify()
      .pipe concat 'app-coffee.js'
    .pipe sourcemaps.write './'
    .pipe gulp.dest './dist/assets/js/'
    .pipe connect.reload()


opts = assign({}, watchify.args, {
  entries: 'app/main.js',
  extensions: 'jsx',
  debug: !argv.production
})

bundler = browserify(opts)
bundler.transform(reactify)

jsBundleFile = 'app-js.js'

gulp.task 'browserify', ->
  bundler
    .bundle()
    .pipe(source(jsBundleFile))
    .pipe(buffer())
    .pipe(gulpif(!argv.production, sourcemaps.init({loadMaps: true})))
    .pipe(gulpif(!argv.production, sourcemaps.write('./')))
    .pipe(gulp.dest('./dist/assets/js'))
    .pipe(connect.reload())

gulp.task 'browserify:watchify', ->
  watcher = watchify(bundler)

  watcher
    .on 'error', gutil.log.bind(gutil, 'Browserify Error')
    .on 'update', ->
      updateStart = Date.now()
      console.log('Browserify started')
      watcher.bundle()<commit_msg>perf(web): uglify js<commit_after>argv = require('yargs').argv
assign = require 'lodash.assign'
autoprefixer = require 'gulp-autoprefixer'
browserify = require 'browserify'
buffer = require 'vinyl-buffer'
coffee = require 'gulp-coffee'
concat = require 'gulp-concat'
connect = require 'gulp-connect'
gulp = require 'gulp'
gutil = require 'gulp-util'
gulpif = require 'gulp-if'
minifycss = require 'gulp-minify-css'
sass = require 'gulp-sass'
source = require 'vinyl-source-stream'
sourcemaps = require 'gulp-sourcemaps'
reactify = require 'reactify'
uglify = require 'gulp-uglify'
usemin = require 'gulp-usemin'
watchify = require 'watchify'

gulp.task 'coffee', ->
  gulp.src ['./app/**/*.coffee']
    .pipe sourcemaps.init()
      .pipe coffee({ bare: true }).on('error', gutil.log)
      .pipe uglify()
      .pipe concat 'app-coffee.js'
    .pipe sourcemaps.write './'
    .pipe gulp.dest './dist/assets/js/'
    .pipe connect.reload()


opts = assign({}, watchify.args, {
  entries: 'app/main.js',
  extensions: 'jsx',
  debug: !argv.production
})

bundler = browserify(opts)
bundler.transform(reactify)

jsBundleFile = 'app-js.js'

gulp.task 'browserify', ->
  bundler
    .bundle()
    .pipe(source(jsBundleFile))
    .pipe(buffer())
    .pipe(gulpif(!argv.production, sourcemaps.init({loadMaps: true})))
    .pipe(gulpif(!argv.production, sourcemaps.write('./')))
    .pipe(gulpif(argv.production, uglify()))
    .pipe(gulp.dest('./dist/assets/js'))
    .pipe(connect.reload())

gulp.task 'browserify:watchify', ->
  watcher = watchify(bundler)

  watcher
    .on 'error', gutil.log.bind(gutil, 'Browserify Error')
    .on 'update', ->
      updateStart = Date.now()
      console.log('Browserify started')
      watcher.bundle()
{'fraction_non_alphanumeric': 0.16773816481589712, 'fraction_numerical': 0.0, 'mean_word_length': 3.8279266572637516, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2337228', 'n_tokens_mistral': 1233, 'n_tokens_neox': 1218, 'n_words': 251}