<commit_before>
var URL = require("url2");

module.exports = reconfigure;
function reconfigure(appPackage, config) {
    // reconfigure. build locations must be computed first
    Object.forEach(appPackage.packages, reconfigurePackage);
}


function reconfigurePackage(package) {
    var config = package.config;
    var description = package.packageDescription;
    var reconfig = {};
    reconfig.name = description.name;
    reconfig.version = description.version;
    reconfig.hash = package.hash;
    reconfig.main = description.main;
    reconfig.redirects = description.redirects;
    if (description.directories && description.directories.lib !== "lib") {
        reconfig.directories = reconfig.directories || {};
        reconfig.directories.lib = description.directories.lib;
    }
    var mappings = reconfig.mappings = {};
    Object.keys(config.mappings).forEach(function (name) {
        var mapping = package.packages[config.mappings[name].location];
        mappings[name] = {
            name: mapping.config.name,
            hash: mapping.hash.slice(0, 7),
            location: URL.relative(package.buildLocation, mapping.buildLocation)
        };
    });
    reconfig.useScriptInjection = true;

    if (!package.files["package.json"]) {
        throw new Error("Can't find package.json in " + JSON.stringify(package.location));
    }
    package.files["package.json"].utf8 = JSON.stringify(reconfig);
}

<commit_msg>Enable production mode in reconfigured packages.jsons<commit_after>
var URL = require("url2");

module.exports = reconfigure;
function reconfigure(appPackage, config) {
    // reconfigure. build locations must be computed first
    Object.forEach(appPackage.packages, reconfigurePackage);
}


function reconfigurePackage(package) {
    var config = package.config;
    var description = package.packageDescription;
    var reconfig = {};
    reconfig.name = description.name;
    reconfig.version = description.version;
    reconfig.hash = package.hash;
    reconfig.main = description.main;
    reconfig.redirects = description.redirects;
    if (description.directories && description.directories.lib !== "lib") {
        reconfig.directories = reconfig.directories || {};
        reconfig.directories.lib = description.directories.lib;
    }
    var mappings = reconfig.mappings = {};
    Object.keys(config.mappings).forEach(function (name) {
        var mapping = package.packages[config.mappings[name].location];
        mappings[name] = {
            name: mapping.config.name,
            hash: mapping.hash.slice(0, 7),
            location: URL.relative(package.buildLocation, mapping.buildLocation)
        };
    });
    reconfig.production = true;
    reconfig.useScriptInjection = true;

    if (!package.files["package.json"]) {
        throw new Error("Can't find package.json in " + JSON.stringify(package.location));
    }
    package.files["package.json"].utf8 = JSON.stringify(reconfig);
}


{'fraction_non_alphanumeric': 0.12135593220338983, 'fraction_numerical': 0.002711864406779661, 'mean_word_length': 3.358936484490399, 'pattern_counts': {'":': 0, '<': 3, '<?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': '2051594', 'n_tokens_mistral': 818, 'n_tokens_neox': 806, 'n_words': 159}