UNPKG

lerna

Version:

Lerna is a fast, modern build system for managing and publishing multiple JavaScript/TypeScript packages from the same repository

24 lines (22 loc) 799 B
// libs/commands/publish/src/lib/create-temp-licenses.ts import fs from "fs-extra"; import pMap from "p-map"; import path from "path"; function createTempLicenses(srcLicensePath, packagesToBeLicensed) { if (!srcLicensePath || !packagesToBeLicensed.length) { return Promise.resolve(); } const licenseFileName = path.basename(srcLicensePath); const options = { // make an effort to keep package contents stable over time preserveTimestamps: process.arch !== "ia32" // (give up on 32-bit architecture to avoid fs-extra warning) }; packagesToBeLicensed.forEach((pkg) => { pkg.licensePath = path.join(pkg.contents, licenseFileName); }); return pMap(packagesToBeLicensed, (pkg) => fs.copy(srcLicensePath, pkg.licensePath, options)); } export { createTempLicenses };