function checkLicense()

in src/check-license.js [58:82]


function checkLicense (repos) {
    // get the license info for each repo's dependencies and sub-dependencies
    const results = [];
    let previous = Promise.resolve();
    repos.forEach(function (repo) {
        previous = previous.then(function () {
            const packageDir = findPackageDir(repo);
            if (packageDir) {
                reposWithDependencies.push(repo.id);
                return getRepoLicense(packageDir);
            } else {
                console.log('Repo directory does not exist: ' + repos.repoName + '. First run coho repo-clone.'); // don't end execution if repo doesn't have dependencies or doesn't exist
            }
        }).then(function (data) {
            results.push(data); // push the result of this repo to the results array for later processing
        });
    });

    // process the results after the licenses for all repos have been retrieved
    previous.then(function (result) {
        processResults(results, repos);
    }, function (err) {
        console.log(err);
    });
}