Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if (packageConfigs) {
log.verbose('loadPackages', 'using provided packageConfigs', {
packageConfigs: effectivePackageConfigs
})
} else {
log.verbose('loadPackages', 'using default packageConfigs', {
packageConfigs: effectivePackageConfigs
})
}
const loadedPackages = PackageUtilities.getPackages({
rootPath: repo.rootPath,
packageConfigs: effectivePackageConfigs
})
const batched = PackageUtilities.topologicallyBatchPackages(loadedPackages)
return _.flatten(batched)
}
return taskFn => {
const filteredLernaPackages = filterBuilt(lernaPackages, log, build);
const promisifiedTaskFn = Promise.method(taskFn);
const forEachTracker = log.newGroup('batched', lernaPackages.length);
npmlog.enableProgress();
const batchedPackages = PackageUtilities.topologicallyBatchPackages(filteredLernaPackages);
const lernaTaskFn = lernaPackage => done => {
const promiseTracker = forEachTracker.newItem(lernaPackage.name);
promiseTracker.pause();
promisifiedTaskFn(lernaPackage, promiseTracker)
.then(() => build && markPackageBuilt(lernaPackage, {log: forEachTracker})(build))
.then(done)
.catch(done)
.finally(() => {
promiseTracker.resume();
promiseTracker.completeWork(1);
})
};
return new Promise((resolve, reject) => {
PackageUtilities.runParallelBatches(batchedPackages, lernaTaskFn, 4, err => err ? reject(err) : resolve());
});