async function populateLicenseAndNoticeContent()

in generate-attribution/generate-attribution-file.js [387:411]


async function populateLicenseAndNoticeContent(dependencies) {
    // For the apache license we can hardcode this since it is supposed to be unedited
    const officialApacheLicensePath = path.join(__dirname, 'LICENSE-2.0.txt');
    const officialApacheLicense = await fsPromises.readFile(officialApacheLicensePath, 'utf-8');

    for (let i = 0; i < dependencies.length; i++) {
        const dep = dependencies[i];
        const depLicensesDirPath = path.join(projectLicensesDirectory, dep.module);

        if (!dep.modulePath) {
            console.log("Dep has no module path", dep);
            process.exit(1);
        }

        if (dep.licenseType === 'Apache-2.0') {
            dep.licenseContent = officialApacheLicense;
        } else {
            dep.licenseContent = await readLicenseContent(dep, depLicensesDirPath);
        }

        dep.noticeContent = await readNoticeFile(depLicensesDirPath);
    }

    return dependencies;
}