<commit_before>const gulp = require('gulp'),
      multipipe = require('multipipe'),
      path = require('path'),
      browserify = require('browserify'),
      browserSync = require('browser-sync'),
      reload = browserSync.reload,
      source = require('vinyl-source-stream'),
      {
        autoprefixer,
        cached,
        clean,
        concat,
        jshint,
        less,
        lessReporter,
        minifyCss,
        minifyHtml,
        pipe,
        print,
        remember,
        sequence,
        sourcemaps,
        uglify,
        util
      } = require('gulp-load-plugins')();

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

gulp.task('build', sequence('clean-dist', ['js:debug', 'less:debug', 'html', 'images', 'fonts'], ['minify-css', 'minify-html', 'minify-js']));

gulp.task('dev', cb => {
  const {src} = paths;

  sequence('clean-dev', ['js:debug', 'less:debug', 'html'], 'browser-sync')(cb);

  gulp.watch(src.html, [reload]);
  gulp.watch(src.scripts, ['js:debug', reload]);
  gulp.watch(src.templates, ['js:debug', reload]);
  gulp.watch(src.less, ['less:debug'])
      .on('change', event => {
        if (event.type === 'deleted') {
          delete cached.caches['less'][event.path];
          remember.forget('less', event.path);
        }
      });
});

gulp.task('browser-sync', () => reload());

gulp.task('js:debug', ['jshint'],
  () => pipe([
    browserify({
      entries: [paths.src.app],
      debug: true
    }).bundle()
    ,source('app.js')
    ,print()
    ,gulp.dest(paths.dev.$)
  ]));

gulp.task('js', ['jshint']);

gulp.task('jshint',
  () => pipe([
    gulp.src(paths.src.scripts)
    ,cached('jshint')
    ,print()
    ,jshint()
    ,jshint.reporter('jshint-stylish')
    ,jshint.reporter('fail')
  ]));

gulp.task('less:debug',
  () => multipipe( // my gulp-pipe fails here because of the less().on [doesn't forward errors]
    gulp.src(paths.src.less)
    ,print()
    ,cached('less')
    ,sourcemaps.init()
    ,less()
      .on('error', lessReporter)
    ,autoprefixer()
    ,sourcemaps.write()
    ,remember('less')
    ,concat('app.css')
    ,print()
    ,gulp.dest(paths.dev.$)
    ,reload({stream: true})
  ));

gulp.task('minify-css',
  () => pipe([
    gulp.src([paths.dev.css])
    ,print()
    ,minifyCss()
    ,gulp.dest(paths.dist.$)
  ]));

gulp.task('minify-js',
  () => pipe([
    gulp.src([paths.dev.app])
    ,print()
    ,uglify()
    ,gulp.dest(paths.dist.$)
  ]));

gulp.task('minify-html',
  () => pipe([
    gulp.src([paths.dev.html])
    ,print()
    ,minifyHtml()
    ,gulp.dest(paths.dist.$)
  ]));

gulp.task('html',
  () => pipe([
    gulp.src(paths.src.html)
    ,print()
    ,gulp.dest(paths.dev.$)
  ]));

gulp.task('browser-sync',
  () => browserSync({
    server: {
      baseDir: paths.dev.$
    }
  }));

gulp.task('images');

gulp.task('fonts');

gulp.task('clean-dev',
  () => pipe([
    gulp.src(paths.dev.$, {read: false})
    ,clean()
  ]));

gulp.task('clean-dist',
  () => pipe([
    gulp.src(paths.dist.$, {read: false})
    ,clean()
  ]));

const paths = {
  src: {
    $: './src',
    app: ['./src/app.js'],
    less: ['./src/**/*.less'],
    html: ['./src/index.html'],
    scripts: ['./src/**/*.js'],
    templates: ['./src/modules/**/*.html']
  },
  dist: {
    $: './.dist',
    app: './.dist/app.js',
    css: './.dist/app.css',
    html: './.dist/index.html'
  },<commit_msg>Fix to listen for new files.<commit_after>const gulp = require('gulp'),
      multipipe = require('multipipe'),
      path = require('path'),
      browserify = require('browserify'),
      browserSync = require('browser-sync'),
      reload = browserSync.reload,
      source = require('vinyl-source-stream'),
      {
        autoprefixer,
        cached,
        clean,
        concat,
        jshint,
        less,
        lessReporter,
        minifyCss,
        minifyHtml,
        pipe,
        print,
        remember,
        sequence,
        sourcemaps,
        uglify,
        util
      } = require('gulp-load-plugins')();

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

gulp.task('build', sequence('clean-dist', ['js:debug', 'less:debug', 'html', 'images', 'fonts'], ['minify-css', 'minify-html', 'minify-js']));

gulp.task('dev', cb => {
  const {src} = paths;

  sequence('clean-dev', ['js:debug', 'less:debug', 'html'], 'browser-sync')(cb);

  gulp.watch(src.html, [reload]);
  gulp.watch(src.scripts, ['js:debug', reload]);
  gulp.watch(src.templates, ['js:debug', reload]);
  gulp.watch(src.less, ['less:debug'])
      .on('change', event => {
        if (event.type === 'deleted') {
          delete cached.caches['less'][event.path];
          remember.forget('less', event.path);
        }
      });
});

gulp.task('browser-sync', () => reload());

gulp.task('js:debug', ['jshint'],
  () => pipe([
    browserify({
      entries: [paths.src.app],
      debug: true
    }).bundle()
    ,source('app.js')
    ,print()
    ,gulp.dest(paths.dev.$)
  ]));

gulp.task('js', ['jshint']);

gulp.task('jshint',
  () => pipe([
    gulp.src(paths.src.scripts)
    ,cached('jshint')
    ,print()
    ,jshint()
    ,jshint.reporter('jshint-stylish')
    ,jshint.reporter('fail')
  ]));

gulp.task('less:debug',
  () => multipipe( // my gulp-pipe fails here because of the less().on [doesn't forward errors]
    gulp.src(paths.src.less)
    ,cached('less')
    ,print()
    ,sourcemaps.init()
    ,less()
      .on('error', lessReporter)
    ,autoprefixer()
    ,sourcemaps.write()
    ,remember('less')
    ,concat('app.css')
    ,print()
    ,gulp.dest(paths.dev.$)
    ,reload({stream: true})
  ));

gulp.task('minify-css',
  () => pipe([
    gulp.src([paths.dev.css])
    ,print()
    ,minifyCss()
    ,gulp.dest(paths.dist.$)
  ]));

gulp.task('minify-js',
  () => pipe([
    gulp.src([paths.dev.app])
    ,print()
    ,uglify()
    ,gulp.dest(paths.dist.$)
  ]));

gulp.task('minify-html',
  () => pipe([
    gulp.src([paths.dev.html])
    ,print()
    ,minifyHtml()
    ,gulp.dest(paths.dist.$)
  ]));

gulp.task('html',
  () => pipe([
    gulp.src(paths.src.html)
    ,print()
    ,gulp.dest(paths.dev.$)
  ]));

gulp.task('browser-sync',
  () => browserSync({
    server: {
      baseDir: paths.dev.$
    }
  }));

gulp.task('images');

gulp.task('fonts');

gulp.task('clean-dev',
  () => pipe([
    gulp.src(paths.dev.$, {read: false})
    ,clean()
  ]));

gulp.task('clean-dist',
  () => pipe([
    gulp.src(paths.dist.$, {read: false})
    ,clean()
  ]));

const paths = {
  src: {
    $: './src',
    app: ['./src/app.js'],
    less: ['src/**/*.less'],
    html: ['./src/index.html'],
    scripts: ['src/**/*.js'],
    templates: ['src/modules/**/template.html']
  },
  dist: {
    $: './.dist',
    app: './.dist/app.js',
    css: './.dist/app.css',
    html: './.dist/index.html'
  },
{'fraction_non_alphanumeric': 0.23397341211225997, 'fraction_numerical': 0.0, 'mean_word_length': 2.569319978914075, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 29, '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': '1315691', 'n_tokens_mistral': 2548, 'n_tokens_neox': 2524, 'n_words': 383}