<commit_before>var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
var browserify = require('browserify');
var cachingCoffeeify = require('caching-coffeeify');
var transform = require('vinyl-transform');
var del = require('del');

var paths = {
  entry: './src/index.coffee',
  scripts: './src/**/*.coffee',
  testEntry: './test/unit/src/index.coffee',
  tests: './test/unit/src/**/*.coffee',
  output: './dist'
};

var getBundleName = function () {
  var name = require('./package.json').name;
  return name + '.' + 'min.js';
};

var coffeeBrowserify = function(standalone){
  return transform(function(filename){
    var b = browserify(filename, {
      extensions: ['.coffee'],
      paths: ['.'],
      standalone: standalone || null
    });
    b.transform(cachingCoffeeify)
    return b.bundle();
  });
};

gulp.task('clean', function(cb) {
  del([paths.output], cb);
});

gulp.task('build', function() {
  
  return gulp.src(paths.entry)
    .pipe(coffeeBrowserify('FluxPlus'))
    .pipe(uglify())
    .pipe(rename(getBundleName()))
    .pipe(gulp.dest(paths.output));
  
});

gulp.task('build-tests', function() {
  
  return gulp.src(paths.testEntry)
    .pipe(coffeeBrowserify())
    .pipe(rename('tests.js'))
    .pipe(gulp.dest(paths.output));
  
});

gulp.task('watch', function() {
  
  livereload.listen();
  
  gulp.watch([paths.entry, paths.scripts], ['build'])
    .on('change', livereload.changed);
  
  gulp.watch([paths.testEntry, paths.tests], ['build-tests'])
    .on('change', livereload.changed);
  
});

// The default task (called when you run `gulp` from cli)
gulp.task('default', ['build', 'build-tests', 'watch']);
<commit_msg>Livereload now only reloads after the build is done.<commit_after>var gulp = require('gulp');
var rename = require('gulp-rename');
var uglify = require('gulp-uglify');
var livereload = require('gulp-livereload');
var browserify = require('browserify');
var cachingCoffeeify = require('caching-coffeeify');
var transform = require('vinyl-transform');
var del = require('del');

var paths = {
  entry: './src/index.coffee',
  scripts: './src/**/*.coffee',
  testEntry: './test/unit/src/index.coffee',
  tests: './test/unit/src/**/*.coffee',
  output: './dist'
};

var reloader = null;

var getBundleName = function () {
  var name = require('./package.json').name;
  return name + '.' + 'min.js';
};

var coffeeBrowserify = function(standalone){
  return transform(function(filename){
    var b = browserify(filename, {
      extensions: ['.coffee'],
      paths: ['.'],
      standalone: standalone || null
    });
    b.transform(cachingCoffeeify)
    return b.bundle();
  });
};

gulp.task('clean', function(cb) {
  del([paths.output], cb);
});

gulp.task('build', function() {
  
  var stream = gulp.src(paths.entry)
    .pipe(coffeeBrowserify('FluxPlus'))
    .pipe(uglify())
    .pipe(rename(getBundleName()))
    .pipe(gulp.dest(paths.output));
  
  if(reloader){
    stream.on('end', livereload.changed);
  }
  
  return stream;
  
});

gulp.task('build-tests', function() {
  
  var stream = gulp.src(paths.testEntry)
    .pipe(coffeeBrowserify())
    .pipe(rename('tests.js'))
    .pipe(gulp.dest(paths.output));
  
  if(reloader){
    stream.on('end', livereload.changed);
  }
  
  return stream;
  
});

gulp.task('watch', function() {
  
  reloader = livereload.listen();
  
  gulp.watch([paths.entry, paths.scripts], ['build']);
  gulp.watch([paths.testEntry, paths.tests], ['build-tests']);
  
});

// The default task (called when you run `gulp` from cli)
gulp.task('default', ['build', 'build-tests', 'watch']);

{'fraction_non_alphanumeric': 0.19896711062788802, 'fraction_numerical': 0.0, 'mean_word_length': 3.867724867724868, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '6758300', 'n_tokens_mistral': 1296, 'n_tokens_neox': 1261, 'n_words': 236}