{"size": 1066, "ext": "js", "max_stars_repo_path": "node_modules/yamat/dist/src/link.js", "max_stars_repo_name": "cancerberoSgx/typescript-in-the-browser", "max_stars_repo_stars_event_min_datetime": "2018-09-25T15:04:40.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-24T12:06:14.000Z", "max_issues_repo_path": "node_modules/yamat/dist/src/link.js", "max_issues_repo_name": "cancerberoSgx/typescript-in-the-browser", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/yamat/dist/src/link.js", "max_forks_repo_name": "cancerberoSgx/typescript-in-the-browser", "max_forks_repo_forks_event_min_datetime": "2019-12-18T16:33:37.000Z", "max_forks_repo_forks_event_max_datetime": "2021-11-07T04:47:40.000Z"}
{"max_stars_count": 36, "max_issues_count": null, "max_forks_count": 4, "avg_line_length": 38.0714285714, "max_line_length": 80, "alphanum_fraction": 0.6341463415}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const util_1 = require("./util");
const path_1 = require("path");
function link(yamatConfig) {
    yamatConfig.rootPath = yamatConfig.rootPath || '.';
    yamatConfig.rootPath = path_1.resolve(yamatConfig.rootPath);
    const config = util_1.getConfig(yamatConfig);
    config.forEach(c => {
        const pj = util_1.parsePackageJson(yamatConfig, c.path);
        modifyJSONDeps(pj, 'dependencies', config, c);
        modifyJSONDeps(pj, 'devDependencies', config, c);
        util_1.writePackageJson(yamatConfig, c.path, pj);
    });
    console.log('Packages successfully linked!');
}
exports.link = link;
function modifyJSONDeps(pj, propertyName, config, c) {
    Object.keys(pj[propertyName] || {})
        .filter(d => config.find(c => c.name === d))
        .forEach(d => {
        const found = config.find(c => c.name === d);
        if (found) {
            pj[propertyName][d] = 'file:' + path_1.relative(c.path, found.path);
        }
    });
}
//# sourceMappingURL=link.js.map