<commit_before>var babelify = require('babelify')
var browserify = require('browserify')
var del = require('del')
var glob = require('glob')
var gulp = require('gulp')
var merge2 = require('merge2')
var path = require('path')
var runSequence = require('run-sequence')
var source = require('vinyl-source-stream')

function bundle (indexFile, dir, deps, cb) {
  var stream = merge2(
    browserify(indexFile, { debug: true })
      .transform(babelify)
      .bundle()
      .pipe(source('bundle.js'))
      .pipe(gulp.dest(dir))
  )

  for (var key in deps) {
    stream.add(
      gulp.src(key)
        .pipe(gulp.dest(path.join(dir, deps[key])))
    )
  }

  stream.on('queueDrain', cb)
}

function createTasks (name) {
  gulp.task(`clean-${name}`, function () {
    return del(`./build/${name}`, { force: true })
  })

  gulp.task(`build-${name}`, function (cb) {
    bundle('./src/shared/index.js', `./build/${name}`, {
      [`./src/${name}/manifest.json`]: '',
      './src/shared/content.js': '',
      './src/shared/images/*': 'images',
      './src/shared/popup/*': 'popup'
    }, cb)
  })

  gulp.task(name, function (cb) {
    runSequence(`clean-${name}`, `build-${name}`, cb)
  })
}

createTasks('firefox')

createTasks('chrome')<commit_msg>Just use strict mode so block scope declarations work in Node 4.x<commit_after>'use strict'

const babelify = require('babelify')
const browserify = require('browserify')
const del = require('del')
const glob = require('glob')
const gulp = require('gulp')
const merge2 = require('merge2')
const path = require('path')
const runSequence = require('run-sequence')
const source = require('vinyl-source-stream')

function bundle (indexFile, dir, deps, cb) {
  let stream = merge2(
    browserify(indexFile, { debug: true })
      .transform(babelify)
      .bundle()
      .pipe(source('bundle.js'))
      .pipe(gulp.dest(dir))
  )

  for (let key in deps) {
    stream.add(
      gulp.src(key)
        .pipe(gulp.dest(path.join(dir, deps[key])))
    )
  }

  stream.on('queueDrain', cb)
}

function createTasks (name) {
  gulp.task(`clean-${name}`, () => del(`./build/${name}`, { force: true }))

  gulp.task(`build-${name}`, (cb) => {
    bundle('./src/shared/index.js', `./build/${name}`, {
      [`./src/${name}/manifest.json`]: '',
      './src/shared/content.js': '',
      './src/shared/images/*': 'images',
      './src/shared/popup/*': 'popup'
    }, cb)
  })

  gulp.task(name, (cb) => {
    runSequence(`clean-${name}`, `build-${name}`, cb)
  })
}

createTasks('firefox')

createTasks('chrome')
{'fraction_non_alphanumeric': 0.21034077555816685, 'fraction_numerical': 0.0027418723070896985, 'mean_word_length': 3.3807890222984565, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, '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': '2035917', 'n_tokens_mistral': 901, 'n_tokens_neox': 896, 'n_words': 174}