<commit_before>// JavaScript Document

// Scripts written by __gulp_init_author_name__ @ __gulp_init_author_company__

const GLOB = require("glob");

module.exports = {
    config(plugins, source_directory, js_directory) {
        const ENTRY = {};

        const SCRIPT_FOLDERS = plugins.fs.readdirSync(source_directory);

        // automatically build entry points based on folders in src/assets/scripts
        if (SCRIPT_FOLDERS.length > 0) {
            SCRIPT_FOLDERS.forEach((folder) => {
                ENTRY[folder] = GLOB.sync(source_directory + "/" + folder + "/**/*.js");
            });
        }

        return {
            mode:   plugins.argv.dist ? "production" : "development",
            entry:  ENTRY,
            output: {
                path:     plugins.path.resolve(__dirname, js_directory),
                filename: "[name].js",
            },
            module: {
                rules: [
                    {
                        test: /\.js$/,
                        use: {
                            loader: "babel-loader",
                            options: {
                                presets: ["@babel/preset-env"],
                            },
                        },
                    },
                ],
            },
        };
    }
};<commit_msg>Make sure folders exist before reading them<commit_after>// JavaScript Document

// Scripts written by __gulp_init_author_name__ @ __gulp_init_author_company__

const GLOB = require("glob");

module.exports = {
    config(plugins, source_directory, js_directory) {
        const ENTRY = {};

        const SCRIPT_FOLDERS = plugins.fs.existsSync(source_directory) ? plugins.fs.readdirSync(source_directory) : false;

        // automatically build entry points based on folders in src/assets/scripts
        if (SCRIPT_FOLDERS && SCRIPT_FOLDERS.length > 0) {
            SCRIPT_FOLDERS.forEach((folder) => {
                ENTRY[folder] = GLOB.sync(source_directory + "/" + folder + "/**/*.js");
            });
        }

        return {
            mode:   plugins.argv.dist ? "production" : "development",
            entry:  ENTRY,
            output: {
                path:     plugins.path.resolve(__dirname, js_directory),
                filename: "[name].js",
            },
            module: {
                rules: [
                    {
                        test: /\.js$/,
                        use: {
                            loader: "babel-loader",
                            options: {
                                presets: ["@babel/preset-env"],
                            },
                        },
                    },
                ],
            },
        };
    }
};
{'fraction_non_alphanumeric': 0.11208791208791209, 'fraction_numerical': 0.0007326007326007326, 'mean_word_length': 1.2149229521492295, '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': '7084878', 'n_tokens_mistral': 736, 'n_tokens_neox': 682, 'n_words': 129}