<commit_before>// Gulp ----------------------------------
// Gulp is a build system/task automator written for nodejs. It’s useful
// for simplifying and speeding up your build process, automating tasks
// such as compiling code, minification, and concatenation.
// ---------------------------------------





// Gulp utility

var gulp               = require('gulp'),
	gutil              = require('gulp-util'),
	gulpif             = require('gulp-if');

// Requires.

var nodemon            = require('gulp-nodemon'),
	plumber            = require('gulp-plumber'),
	del                = require('del'),
	runsequence        = require('run-sequence'),
	importOnce         = require('node-sass-import-once');

// Plugin requires.

var concat             = require('gulp-concat'),
	eslint             = require('gulp-eslint'),
	uglify             = require('gulp-uglify'),
	rename             = require('gulp-rename'),
	sass               = require('gulp-sass'),
	autoprefixer       = require('gulp-autoprefixer'),
	nano               = require('gulp-cssnano'),
	sourcemaps         = require('gulp-sourcemaps'),
	livereload         = require('gulp-livereload'),
	sasslint           = require('gulp-sass-lint'),
	imagemin           = require('gulp-imagemin'),
	newer              = require('gulp-newer'),
	notify             = require('gulp-notify');

// Load external config.

var config             = require('./gulp-config.json'),
	publicDirectory    = config.publicDirectory;





// Error Handling and Notification -------
// Make error handling easier by outputting the error message
// to the console and sending a notification.
// ---------------------------------------
// 1. Setup the error notification.
// 2. Log error to console.
// 3. Let gulp know to end the task that errors and not to break
//    the run (forcing you to restart gulp).

function errorAlert(err) {

	notify.onError({
		title: 'Error', message: '<%= error.message %>', sound: 'Sosumi'
	})(err);
	console.log(err.toString());
	this.emit('end');

}





// Script build task ---------------------
// Combines and uglifies JS, producing both a minified and non-minified
// version in public/js.
// ---------------------------------------
// 1. Assign our output directory to a variable.
// 2. Use all files defined by files.scripts within config.
// 3. Pipe the readable stream through gulp-plumber, which prevents pipe
//    breaking caused by errors from gulp plugins (replaces pipe method
//    and removes standard onerror handler on errors event, which unpipes
//    streams on error by default). Pass in our errorAlert function
//    to the onerror handler.
// 4. Run JSHint and report the output.
// 5. Combine into main.js
// 6. Output combined but non-minified version to public/js.
// 7. Rename to main.min.js
// 8. Uglify to minify.
// 9. Output minified version to public/js.

gulp.task('scripts', function() {

	var outputDirectory = publicDirectory + 'js/';                 // [1]

	return gulp.src(config.files.scripts)                          // [2]
		.pipe(plumber({errorHandler: errorAlert}))                 // [3]
		.pipe(eslint())                                            // [4]
		.pipe(eslint.format())
		.pipe(eslint.failAfterError())
		.pipe(concat('main.js'))                                   // [5]
		.pipe(gulp.dest(outputDirectory))                          // [6]<commit_msg>Update script build task comments to remove JSHint reference.<commit_after>// Gulp ----------------------------------
// Gulp is a build system/task automator written for nodejs. It’s useful
// for simplifying and speeding up your build process, automating tasks
// such as compiling code, minification, and concatenation.
// ---------------------------------------





// Gulp utility

var gulp               = require('gulp'),
	gutil              = require('gulp-util'),
	gulpif             = require('gulp-if');

// Requires.

var nodemon            = require('gulp-nodemon'),
	plumber            = require('gulp-plumber'),
	del                = require('del'),
	runsequence        = require('run-sequence'),
	importOnce         = require('node-sass-import-once');

// Plugin requires.

var concat             = require('gulp-concat'),
	eslint             = require('gulp-eslint'),
	uglify             = require('gulp-uglify'),
	rename             = require('gulp-rename'),
	sass               = require('gulp-sass'),
	autoprefixer       = require('gulp-autoprefixer'),
	nano               = require('gulp-cssnano'),
	sourcemaps         = require('gulp-sourcemaps'),
	livereload         = require('gulp-livereload'),
	sasslint           = require('gulp-sass-lint'),
	imagemin           = require('gulp-imagemin'),
	newer              = require('gulp-newer'),
	notify             = require('gulp-notify');

// Load external config.

var config             = require('./gulp-config.json'),
	publicDirectory    = config.publicDirectory;





// Error Handling and Notification -------
// Make error handling easier by outputting the error message
// to the console and sending a notification.
// ---------------------------------------
// 1. Setup the error notification.
// 2. Log error to console.
// 3. Let gulp know to end the task that errors and not to break
//    the run (forcing you to restart gulp).

function errorAlert(err) {

	notify.onError({
		title: 'Error', message: '<%= error.message %>', sound: 'Sosumi'
	})(err);
	console.log(err.toString());
	this.emit('end');

}





// Script build task ---------------------
// Combines and uglifies JS, producing both a minified and non-minified
// version in public/js.
// ---------------------------------------
// 1. Assign our output directory to a variable.
// 2. Use all files defined by files.scripts within config.
// 3. Pipe the readable stream through gulp-plumber, which prevents pipe
//    breaking caused by errors from gulp plugins (replaces pipe method
//    and removes standard onerror handler on errors event, which unpipes
//    streams on error by default). Pass in our errorAlert function
//    to the onerror handler.
// 4. Run ESLint and report the output.
// 5. Combine into main.js
// 6. Output combined but non-minified version to public/js.
// 7. Rename to main.min.js
// 8. Uglify to minify.
// 9. Output minified version to public/js.

gulp.task('scripts', function() {

	var outputDirectory = publicDirectory + 'js/';                 // [1]

	return gulp.src(config.files.scripts)                          // [2]
		.pipe(plumber({errorHandler: errorAlert}))                 // [3]
		.pipe(eslint())                                            // [4]
		.pipe(eslint.format())
		.pipe(eslint.failAfterError())
		.pipe(concat('main.js'))                                   // [5]
		.pipe(gulp.dest(outputDirectory))                          // [6]
{'fraction_non_alphanumeric': 0.1723379290114403, 'fraction_numerical': 0.005280140803754767, 'mean_word_length': 1.8459933222036728, 'pattern_counts': {'":': 0, '<': 5, '<?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': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2164004', 'n_tokens_mistral': 1944, 'n_tokens_neox': 1847, 'n_words': 571}