<commit_before>'use strict';

// @todo find alternative for finding recursive template strings
// remove grunt as template finder

/*************
 ** MODULES **
 *************/
const _       = require('lodash');
const gulp    = require('gulp');
const grunt   = require('grunt');
const merge   = require('merge-stream');
const paths   = require('./config/paths.json');
const plugins = require('gulp-load-plugins')();
const deleteEmpty = require('delete-empty');
const browserSync = require('browser-sync').create();

/**
 * get a task in ./config/gulp/
 *
 * @param  {string} mainTask the filename for the task
 * @param  {string} subTask  the returned task from the filename
 *
 * @return {Stream}
 */
const getTask = (mainTask, subTask) => {
    const task = require('./config/gulp/' + mainTask)({gulp, plugins, paths});

    return task[subTask];
};

gulp.util   = require('gulp-util');
gulp.util._ = _;
gulp.data   = grunt.config;
gulp.data.init(paths);

/***********
 ** TASKS **
 ***********/
gulp.task('default', ['build:prod']);

// 0. Helper
// ---------
gulp.task('clean', () => {
    return gulp.src(_.flatten([
            gulp.data.get('paths.dev.base'),
            gulp.data.get('paths.dest.base'),
            gulp.data.get('paths.reports.base'),
            './coverage'
        ]))
        .pipe(plugins.clean());
});

// 1. Managing
// -----------
gulp.task('manage', ['manage:sass', 'manage:js:vendor', 'manage:js']);
gulp.task('manage:js', getTask('manage', 'js:own'));
gulp.task('manage:js:vendor', getTask('manage', 'js:vendor'));
gulp.task('manage:sass', ['manage:sass:browser'], getTask('manage', 'sass'));
gulp.task('manage:sass:browser', getTask('manage', 'sass:browser'));

// 2. Linting
// ----------
gulp.task('lint', ['lint:js', 'lint:scss', 'lint:html']);
gulp.task('lint:fail', ['lint:js:fail', 'lint:scss:fail', 'lint:html:fail']);
gulp.task('lint:js', getTask('lint', 'js'));
gulp.task('lint:js:fail', getTask('lint', 'js:fail'));
gulp.task('lint:scss', getTask('lint', 'scss'));
gulp.task('lint:scss:fail', getTask('lint', 'scss:fail'));
gulp.task('lint:html', getTask('lint', 'html'));
gulp.task('lint:html:fail', getTask('lint', 'html:fail'));

// 3. Minifying
// ------------
gulp.task('minify', ['minify:css', 'minify:js', 'minify:html']);
gulp.task('minify:js', ['manage:js', 'minify:css'], getTask('minify', 'js'));
gulp.task('minify:css', ['manage:sass'], getTask('minify', 'css'));
gulp.task('minify:html', ['minify:css'], getTask('minify', 'html'));
<commit_msg>added manage:js now combine all subtasks from manage:js<commit_after>'use strict';

// @todo find alternative for finding recursive template strings
// remove grunt as template finder

/*************
 ** MODULES **
 *************/
const _       = require('lodash');
const gulp    = require('gulp');
const grunt   = require('grunt');
const merge   = require('merge-stream');
const paths   = require('./config/paths.json');
const plugins = require('gulp-load-plugins')();
const deleteEmpty = require('delete-empty');
const browserSync = require('browser-sync').create();

/**
 * get a task in ./config/gulp/
 *
 * @param  {string} mainTask the filename for the task
 * @param  {string} subTask  the returned task from the filename
 *
 * @return {Stream}
 */
const getTask = (mainTask, subTask) => {
    const task = require('./config/gulp/' + mainTask)({gulp, plugins, paths});

    return task[subTask];
};

gulp.util   = require('gulp-util');
gulp.util._ = _;
gulp.data   = grunt.config;
gulp.data.init(paths);

/***********
 ** TASKS **
 ***********/
gulp.task('default', ['build:prod']);

// 0. Helper
// ---------
gulp.task('clean', () => {
    return gulp.src(_.flatten([
            gulp.data.get('paths.dev.base'),
            gulp.data.get('paths.dest.base'),
            gulp.data.get('paths.reports.base'),
            './coverage'
        ]))
        .pipe(plugins.clean());
});

// 1. Managing
// -----------
gulp.task('manage', ['manage:sass', 'manage:js']);
gulp.task('manage:js', ['manage:js:own', 'manage:js:vendor']);
gulp.task('manage:js:own', getTask('manage', 'js:own'));
gulp.task('manage:js:vendor', getTask('manage', 'js:vendor'));
gulp.task('manage:sass', ['manage:sass:browser'], getTask('manage', 'sass'));
gulp.task('manage:sass:browser', getTask('manage', 'sass:browser'));

// 2. Linting
// ----------
gulp.task('lint', ['lint:js', 'lint:scss', 'lint:html']);
gulp.task('lint:fail', ['lint:js:fail', 'lint:scss:fail', 'lint:html:fail']);
gulp.task('lint:js', getTask('lint', 'js'));
gulp.task('lint:js:fail', getTask('lint', 'js:fail'));
gulp.task('lint:scss', getTask('lint', 'scss'));
gulp.task('lint:scss:fail', getTask('lint', 'scss:fail'));
gulp.task('lint:html', getTask('lint', 'html'));
gulp.task('lint:html:fail', getTask('lint', 'html:fail'));

// 3. Minifying
// ------------
gulp.task('minify', ['minify:css', 'minify:js', 'minify:html']);
gulp.task('minify:js', ['manage:js', 'minify:css'], getTask('minify', 'js'));
gulp.task('minify:css', ['manage:sass'], getTask('minify', 'css'));
gulp.task('minify:html', ['minify:css'], getTask('minify', 'html'));

{'fraction_non_alphanumeric': 0.26210546951578123, 'fraction_numerical': 0.0015683199372672025, 'mean_word_length': 4.3875395987328405, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '1138949', 'n_tokens_mistral': 1812, 'n_tokens_neox': 1761, 'n_words': 329}