<commit_before>'use strict';

/**
 *  Concatenates and minifys JS source files.
 *
 *  Example Usage:
 *  grunt scripts
 */

var grunt = require('grunt'),
    args = require('yargs').argv,
    common = require('./_common'),
    globalSettings = require('../../_global');

function _requireJS() {
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.config.set('requirejs.options', common.requirejs.defaults);
    grunt.config.set('requirejs.options.logLevel', true);

    for (var i = 0, length = common.requirejs.bundles.length; i < length; i++) {
        var thisBuild = common.requirejs.bundles[i],
            uniqueBuildKey = 'build-' + i + '.options';

        grunt.config.set('requirejs.' + uniqueBuildKey, thisBuild);
    }

    grunt.task.run(['requirejs']);
}

function _browserify() {
    console.log('NOTE: Use Gulp if you\'re wanting to compile via Browserify.');
}

grunt.registerTask('scripts', function() {
    if (globalSettings.moduleFormat === 'requirejs') {
        _requireJS();
    } else {
        _browserify();
    }
});<commit_msg>- Adding basic Grunt workflow for browserify. Still needs minification and source maps.<commit_after>'use strict';

/**
 *  Concatenates and minifys JS source files.
 *
 *  Example Usage:
 *  grunt scripts
 */

var grunt = require('grunt'),
    args = require('yargs').argv,
    common = require('./_common'),
    globalSettings = require('../../_global');

function _requireJS() {
    grunt.loadNpmTasks('grunt-contrib-requirejs');
    grunt.config.set('requirejs.options', common.requirejs.defaults);
    grunt.config.set('requirejs.options.logLevel', true);

    for (var i = 0, length = common.requirejs.bundles.length; i < length; i++) {
        var thisBuild = common.requirejs.bundles[i],
            uniqueBuildKey = 'build-' + i + '.options';

        grunt.config.set('requirejs.' + uniqueBuildKey, thisBuild);
    }

    grunt.task.run(['requirejs']);
}

function _browserify() {
    grunt.loadNpmTasks('grunt-browserify');

    grunt.config.set('browserify', {
        options: {
            browserifyOptions: {
                debug: true
            },
            transform: ['hbsfy']
        }
    });

    for (var i = 0, length = common.browserify.bundles.length; i < length; i++) {
        var thisBundle = common.browserify.bundles[i],
            uniqueBuildKey = 'build-' + i,
            buildObj = {},
            destFile = common.browserify.destPath + thisBundle.fileName + common.browserify.buildFileSuffix,
            srcFile = thisBundle.srcPath + thisBundle.fileName + '.js';

        buildObj.files = {};
        buildObj.files[destFile] = srcFile;
        grunt.config.set('browserify.' + uniqueBuildKey, buildObj);
    }

    grunt.task.run(['browserify']);
}

grunt.registerTask('scripts', function() {
    if (globalSettings.moduleFormat === 'requirejs') {
        _requireJS();
    } else {
        _browserify();
    }
});
{'fraction_non_alphanumeric': 0.15476597198496755, 'fraction_numerical': 0.0010249402118209772, 'mean_word_length': 2.817470664928292, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 3, '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': '4120792', 'n_tokens_mistral': 910, 'n_tokens_neox': 888, 'n_words': 177}