<commit_before>'use strict';

const gulp = require('gulp');
const rollup = require('gulp-rollup');
const babel = require('rollup-plugin-babel');
const eslint = require('rollup-plugin-eslint');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const uglify = require('rollup-plugin-uglify');
const rename = require('gulp-rename');
const scssLint = require('gulp-scss-lint');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const runSequence = require('run-sequence');
const nodemon = require('gulp-nodemon');
const livereload = require('gulp-livereload');

const config = {
    js : {
        src : ['src/js/**/**.js'],
        dest : 'build/js/',
        entry : './src/js/imagecrop.js',
    },
    example : {
        src : ['src/example/**/**.js', 'build/js/**/**.js'],
        dest : 'example/',
        entry : 'src/example/app.js'
    },
    scss : {
        src : ['src/sass/**/**.scss'],
        dest : 'build/css/',
    },
}

//
//  JS
//

    function doRollup (component) {
        return gulp.src(component.src)
        .pipe(
            rollup({
                entry: component.entry,
                format: 'iife',
                moduleName: 'ImageCropper',
                plugins: [
                    resolve({
                        jsnext: true,
                        main: true,
                        browser: true,
                    }),
                    commonjs(),
                    eslint('.eslintrc'),
                    babel({
                        presets: ['es2015-rollup'],
                        plugins : [
                            'check-es2015-constants',
                            'transform-minify-booleans',
                            'transform-property-literals',
                            'transform-member-expression-literals',
                            'transform-merge-sibling-variables'
                        ]
                    }),
                    uglify()
                ],
            })
        )
        .pipe(rename({
            suffix : '.min'
        }))
        .pipe(gulp.dest(component.dest));
    }

    gulp.task('js', () => doRollup(config.js));
    gulp.task('example', () => doRollup(config.example));

//
//  SCSS
//

    gulp.task('scss', () => gulp.src(config.scss.src)
        .pipe(scssLint({
            config : '.scss-lint.yml'
        }))
        .pipe(sass({
            outputStyle : 'compressed'
        }))
        .pipe(autoprefixer())
        .pipe(rename({
            suffix : '.min'
        }))
        .pipe(gulp.dest(config.scss.dest))
    );

    gulp.task('serve', (cb) => nodemon({
        script : 'server.js',
        ext : 'js css html',
        watch : [
            'server'
        ]
    }));

//
//  WATCH
//

    //  Watch the necessary directories for changes and rebuild source files,
    gulp.task('watch', (cb) => {
        livereload.listen();
        gulp.watch(config.scss.src, ['scss']);
        gulp.watch(config.js.src, ['js', 'example']);
        gulp.watch(config.example.src, ['js', 'example'])
        cb();
    });

    //  Build all files + notify user.<commit_msg>further cleanup <commit_after>'use strict';

const gulp = require('gulp');
const runSequence = require('run-sequence');

const rollup = require('gulp-rollup');
const babel = require('rollup-plugin-babel');
const eslint = require('rollup-plugin-eslint');
const resolve = require('rollup-plugin-node-resolve');
const commonjs = require('rollup-plugin-commonjs');
const uglify = require('rollup-plugin-uglify');

const rename = require('gulp-rename');
const scssLint = require('gulp-scss-lint');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const nodemon = require('gulp-nodemon');
const livereload = require('gulp-livereload');

const config = {
    js : {
        src : ['src/js/**/**.js'],
        dest : 'build/js/',
        entry : './src/js/imagecrop.js',
    },
    example : {
        src : ['src/example/**/**.js', 'build/js/**/**.js'],
        dest : 'example/',
        entry : 'src/example/app.js'
    },
    scss : {
        src : ['src/sass/**/**.scss'],
        dest : 'build/css/',
    },
}

//
//  JS
//

    function doRollup (component) {
        return gulp.src(component.src)
        .pipe(
            rollup({
                entry: component.entry,
                format: 'iife',
                moduleName: 'ImageCropper',
                plugins: [
                    resolve({
                        jsnext: true,
                        main: true,
                        browser: true,
                    }),
                    commonjs(),
                    eslint('.eslintrc'),
                    babel({
                        presets: ['es2015-rollup'],
                        plugins : [
                            'check-es2015-constants',
                            'transform-minify-booleans',
                            'transform-property-literals',
                            'transform-member-expression-literals',
                            'transform-merge-sibling-variables'
                        ]
                    }),
                    uglify()
                ],
            })
        )
        .pipe(rename({
            suffix : '.min'
        }))
        .pipe(gulp.dest(component.dest));
    }

    gulp.task('js', () => doRollup(config.js));
    gulp.task('example', () => doRollup(config.example));

//
//  SCSS
//

    gulp.task('scss', () => gulp.src(config.scss.src)
        .pipe(scssLint({
            config : '.scss-lint.yml'
        }))
        .pipe(sass({
            outputStyle : 'compressed'
        }))
        .pipe(autoprefixer())
        .pipe(rename({
            suffix : '.min'
        }))
        .pipe(gulp.dest(config.scss.dest))
    );

    gulp.task('serve', (cb) => nodemon({
        script : 'server.js',
        ext : 'js css html',
        watch : [
            'server'
        ]
    }));

//
//  WATCH
//

    gulp.task('watch', (cb) => {
        livereload.listen();
        gulp.watch(config.scss.src, ['scss']);
        gulp.watch(config.js.src, ['js', 'example']);
        gulp.watch(config.example.src, ['js', 'example'])
        cb();
    });

{'fraction_non_alphanumeric': 0.16555555555555557, 'fraction_numerical': 0.0025396825396825397, 'mean_word_length': 1.461328125, 'pattern_counts': {'":': 0, '<': 3, '<?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': '558444', 'n_tokens_mistral': 1922, 'n_tokens_neox': 1859, 'n_words': 308}