<commit_before>var gulp = require('gulp'),
   runSequence = require('run-sequence').use(gulp) 
   del = require('del'),
   fs = require('fs'),
   jest = require('jest-cli'),
   g = require('gulp-load-plugins')({
      scope: ['dependencies', 'devDependencies', 'peerDependencies'],
      rename : {
        'gulp-pure-cjs' : 'pure',
        'gulp-uglifyjs' : 'uglify'
      }});

var config = {
  build : {
    js : './build/cjs',
    umd : './build/umd',
    fileName : 'rtable.js',
    minFileName : 'rtable.min.js'
  },
  
  jsxSource : './jsx/**/**.js',
  umdSource : './build/cjs/**/**.js',
  distSource  : './build/umd/**/**.js',
  testSource : './tests/**/**.spec.js',

  dist : './dist',
  exports: 'RTable',
  sourceMap : true,
  port : 1234,
    dependencies: [
      {name: 'react', exports: 'React'},
      {name: 'pubsub-js', exports : 'PubSub'}
    ]
};


// Umd options
var options = {
  input:  config.build.js +'/' +config.build.fileName,
  output: config.build.fileName,
  exports: config.exports,
  map: false,
  comments : true,
  external : {
  	react : {amd : 'react', global : 'React'},
  	'pubsub-js' : {amd : 'pubsub-js', global : 'PubSub'}
  }
};

/** Connect **/
 gulp.task('connect', function(){
  return g.connect.server({
    port : config.port,
    livereload : false, 
    root: [__dirname]
  });
});

gulp.task('clean', ['react-clean', 'umd-clean', 'dist-clean']);

gulp.task('build', function(callback){
  runSequence('react', 'umd', 'dist');
});

gulp.task('watch', function () {
	var reactWatch = register(config.jsxSource, ['react']);
	var umdWatch = register(config.umdSource, ['umd', 'dist']);
});

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

gulp.task('dist-clean', function(){
  del(config.dist);
});

gulp.task('dist', function(){
  return gulp.src(config.build.umd +"/"+config.build.fileName)
    .pipe(g.uglify(config.build.minFileName, 
    {
      outSourceMap : config.sourceMap
    }))
    .pipe(gulp.dest(config.dist));
});

/** React **/
gulp.task('react', function(){
  return gulp.src(config.jsxSource)
    .pipe(g.plumber({errorHandler: g.notify.onError("Error: <%= error.message %> ")}))
    .pipe(g.react())
    .pipe(gulp.dest(config.build.js))
    .on('error', g.notify.onError("Error: <%= error.message %>"));
});

gulp.task('react-clean', function(){
	del(config.build.js);
});

/** Test **/

gulp.task('jest', function () {
    return gulp.src(__dirname).pipe(
      g.jest({
        scriptPreprocessor: "./tests/support/preprocessor.js",
        unmockedModulePathPatterns: [
            "node_modules/react"
        ],
        testDirectoryName: "tests",
        testPathIgnorePatterns: [
            "node_modules",
            "tests/support"
        ],
        moduleFileExtensions: [
            "js",
            "json",
            "react"
        ]
    }));
});

gulp.task('watch-test',function(){
  var watch = register([config.testSource, config.jsxSource],['jest']);
});

/** UMD **/
gulp.task('umd-clean', function(){
	del(config.build.umd);;
});

gulp.task('umd', function  () {
	//needs umd folder to exist
	if (!fs.existsSync(config.build.umd)){
	    fs.mkdirSync(config.build.umd);
	}

	return gulp.src(config.build.js +'/' +config.build.fileName)
		.pipe(g.plumber({errorHandler: g.notify.onError("Error: <%= error.message %> ")}))
		.pipe(g.pure(options))
		.pipe(gulp.dest(config.build.umd))
    .pipe(gulp.dest(config.dist))
		.on('error', g.notify.onError("Error: <%= error.message %>"));;
});

//linter

gulp.task('lint', ['react'], function(){
  console.log ('LINT REPORT');
  return gulp.src(config.umdSource)
    .pipe(g.jshint())
    .pipe(g.jshint.reporter(stylish));
});

//functions

function register(path, tasks){
	var watch  = gulp.watch(path,{}, tasks, function(event) {
		console.log(' callback');
	  console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
	});
	
	watch.on('ready', function(watcher){ 
		console.log('ready to watch path: ' + path);
	});

	watch.on('change', function(event) {
	  console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
	});

	watch.on('error', function(error){
		g.notify.onError("Error: <%= error.message %> ")
	});

	return watch;
}

<commit_msg>gulp cleanup<commit_after>var gulp = require('gulp'),
   runSequence = require('run-sequence').use(gulp) 
   del = require('del'),
   fs = require('fs'),
   jest = require('jest-cli'),
   g = require('gulp-load-plugins')({
      scope: ['dependencies', 'devDependencies', 'peerDependencies'],
      rename : {
        'gulp-pure-cjs' : 'pure',
        'gulp-uglifyjs' : 'uglify'
      }});

var config = {
  build : {
    js : './build/cjs',
    umd : './build/umd',
    fileName : 'rtable.js',
    minFileName : 'rtable.min.js'
  },
  
  jsxSource : './jsx/**/**.js',
  umdSource : './build/cjs/**/**.js',
  distSource  : './build/umd/**/**.js',
  testSource : './tests/**/**.spec.js',

  dist : './dist',
  exports: 'RTable',
  sourceMap : true,
  port : 1234,
    dependencies: [
      {name: 'react', exports: 'React'},
      {name: 'pubsub-js', exports : 'PubSub'}
    ]
};


// Umd options
var options = {
  input:  config.build.js +'/' +config.build.fileName,
  output: config.build.fileName,
  exports: config.exports,
  map: false,
  comments : true,
  external : {
  	react : {amd : 'react', global : 'React'},
  	'pubsub-js' : {amd : 'pubsub-js', global : 'PubSub'}
  }
};

/** Connect **/
 gulp.task('connect', function(){
  return g.connect.server({
    port : config.port,
    livereload : false, 
    root: [__dirname]
  });
});

gulp.task('clean', ['react-clean', 'umd-clean', 'dist-clean']);

gulp.task('build', function(){
  runSequence('react', 'umd', 'dist');
});

gulp.task('watch', function () {
	var reactWatch = register(config.jsxSource, ['react']);
	var umdWatch = register(config.umdSource, ['umd', 'dist']);
});

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

gulp.task('dist-clean', function(){
  del(config.dist);
});

gulp.task('dist', function(){
  return gulp.src(config.build.umd +"/"+config.build.fileName)
    .pipe(g.uglify(config.build.minFileName, 
    {
      outSourceMap : config.sourceMap
    }))
    .pipe(gulp.dest(config.dist));
});

/** React **/
gulp.task('react', function(){
  return gulp.src(config.jsxSource)
    .pipe(g.plumber({errorHandler: g.notify.onError("Error: <%= error.message %> ")}))
    .pipe(g.react())
    .pipe(gulp.dest(config.build.js))
    .on('error', g.notify.onError("Error: <%= error.message %>"));
});

gulp.task('react-clean', function(){
	del(config.build.js);
});

/** Test **/

gulp.task('jest', function () {
    return gulp.src(__dirname).pipe(
      g.jest({
        scriptPreprocessor: "./tests/support/preprocessor.js",
        unmockedModulePathPatterns: [
            "node_modules/react"
        ],
        testDirectoryName: "tests",
        testPathIgnorePatterns: [
            "node_modules",
            "tests/support"
        ],
        moduleFileExtensions: [
            "js",
            "json",
            "react"
        ]
    }));
});

gulp.task('watch-test',function(){
  var watch = register([config.testSource, config.jsxSource],['jest']);
});

/** UMD **/
gulp.task('umd-clean', function(){
	del(config.build.umd);;
});

gulp.task('umd', function  () {
	//needs umd folder to exist
	if (!fs.existsSync(config.build.umd)){
	    fs.mkdirSync(config.build.umd);
	}

	return gulp.src(config.build.js +'/' +config.build.fileName)
		.pipe(g.plumber({errorHandler: g.notify.onError("Error: <%= error.message %> ")}))
		.pipe(g.pure(options))
		.pipe(gulp.dest(config.build.umd))
    .pipe(gulp.dest(config.dist))
		.on('error', g.notify.onError("Error: <%= error.message %>"));;
});

//linter

gulp.task('lint', ['react'], function(){
  console.log ('LINT REPORT');
  return gulp.src(config.umdSource)
    .pipe(g.jshint())
    .pipe(g.jshint.reporter(stylish));
});

//functions

function register(path, tasks){
	var watch  = gulp.watch(path,{}, tasks, function(event) {
	  console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
	});
	
	watch.on('ready', function(watcher){ 
		console.log('ready to watch path: ' + path);
	});

	watch.on('change', function(event) {
	  console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
	});

	watch.on('error', function(error){
		g.notify.onError("Error: <%= error.message %> ")
	});

	return watch;
}


{'fraction_non_alphanumeric': 0.21870914061571378, 'fraction_numerical': 0.0009509093070248425, 'mean_word_length': 3.1591695501730106, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5764532', 'n_tokens_mistral': 3082, 'n_tokens_neox': 2995, 'n_words': 487}