flush()

in core/processors/licensing.js [37:81]


        flush(callback) {
            const noticeFileName = path.join(buildInfos.paths.intermediateDir, "ThirdPartyNotice.txt");
            const fd = fs.openSync(noticeFileName, "w+");

            try {
                // Write headers.
                fs.writeSync(fd, "THIRD-PARTY SOFTWARE NOTICES AND INFORMATION\r\n");
                fs.writeSync(fd, "Do Not Translate or Localize\r\n");
                fs.writeSync(fd, "\r\n");
                fs.writeSync(fd, `${buildInfos.productName} incorporates components from the projects listed below. `);
                fs.writeSync(fd, `The original copyright notices and the licenses under which ${packageJson.author} received such components are set forth below. `);
                fs.writeSync(fd, `${packageJson.author} reserves all rights not expressly granted herein, whether by implication, estoppel or otherwise.\r\n`);
                fs.writeSync(fd, "\r\n");

                const depLicenseInfos = Object.values(depLicenses);

                // Write Index.
                for (let depIndex = 0; depIndex < depLicenseInfos.length; depIndex++) {
                    const info = depLicenseInfos[depIndex];

                    fs.writeSync(fd, `${depIndex + 1}.\t${info.name} (${info.homepage})\r\n`);
                }

                // Write license.
                for (let depIndex = 0; depIndex < depLicenseInfos.length; depIndex++) {
                    const info = depLicenseInfos[depIndex];

                    fs.writeSync(fd, "\r\n");
                    fs.writeSync(fd, `${info.name} NOTICES AND INFORMATION BEGIN HERE\r\n`);
                    fs.writeSync(fd, "=========================================\r\n");
                    fs.writeSync(fd, fs.readFileSync(info.licensePath, "utf8"));
                    fs.writeSync(fd, "\r\n");
                    fs.writeSync(fd, "=========================================\r\n");
                    fs.writeSync(fd, `END OF ${info.name} NOTICES AND INFORMATION\r\n`);
                }
            } finally {
                if (fd > 0) {
                    fs.closeSync(fd);
                }
            }

            this.push(vinyl(noticeFileName, buildInfos.paths.intermediateDir));

            callback();
        },