<commit_before>var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babelify = require('babelify');

var mocha = require('gulp-mocha');
var eslint = require('gulp-eslint');

var rebuildDB = require('./dummyData/index');

function compile(watch) {
  var bundler = watchify(browserify('./server/client/index.js', { debug: true }).transform(babelify));

  function rebundle() {
    // rebuildDB();
    bundler.bundle()
      .on('error', function(err) { console.error(err); this.emit('end'); })
      .pipe(source('index.js'))
      .pipe(buffer())
      .pipe(sourcemaps.init({ loadMaps: true }))
      .pipe(sourcemaps.write('./'))
      .pipe(gulp.dest('./server/client/public/scripts'));
  }

  if (watch) {
    bundler.on('update', function() {
      console.log('-> bundling...');
      rebundle();
    });
  }

  rebundle();
}

function watch() {
  return compile(true);
};

gulp.task('bundle', function() { return compile(); });
gulp.task('watch', function() { return watch(); });

gulp.task('default', ['watch']);

gulp.task('mocha', function () {
  return gulp.src('./specs/serverspecs/**/*.spec.js')
    .pipe(mocha({reporter: 'spec'}))
    .once('end', function () {
      process.exit();
    });
});

gulp.task('lint', function () {
  return gulp.src(['server/**/*.js', '!server/client/public/scripts/index.js'])
      .pipe(eslint())
      .pipe(eslint.format())
      // .pipe(eslint.failOnError());
});
<commit_msg>(feat) Add timestamp to Watch bundle<commit_after>var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babelify = require('babelify');

var mocha = require('gulp-mocha');
var eslint = require('gulp-eslint');

var rebuildDB = require('./dummyData/index');

function compile(watch) {
  var bundler = watchify(browserify('./server/client/index.js', { debug: true }).transform(babelify));

  function rebundle() {
    // rebuildDB();
    bundler.bundle()
      .on('error', function(err) { console.error(err); this.emit('end'); })
      .pipe(source('index.js'))
      .pipe(buffer())
      .pipe(sourcemaps.init({ loadMaps: true }))
      .pipe(sourcemaps.write('./'))
      .pipe(gulp.dest('./server/client/public/scripts'));
  }

  if (watch) {
    bundler.on('update', function() {
      console.log('[' + new Date().toTimeString().split(' ')[0] + '] -> bundling...');
      rebundle();
    });
  }

  rebundle();
}

function watch() {
  return compile(true);
};

gulp.task('bundle', function() { return compile(); });
gulp.task('watch', function() { return watch(); });

gulp.task('default', ['watch']);

gulp.task('mocha', function () {
  return gulp.src('./specs/serverspecs/**/*.spec.js')
    .pipe(mocha({reporter: 'spec'}))
    .once('end', function () {
      process.exit();
    });
});

gulp.task('lint', function () {
  return gulp.src(['server/**/*.js', '!server/client/public/scripts/index.js'])
      .pipe(eslint())
      .pipe(eslint.format())
      // .pipe(eslint.failOnError());
});

{'fraction_non_alphanumeric': 0.22276176024279212, 'fraction_numerical': 0.00030349013657056146, 'mean_word_length': 3.7976710334788937, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '3246980', 'n_tokens_mistral': 1095, 'n_tokens_neox': 1072, 'n_words': 192}