Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d8d33f7

Browse files
nicolo-ribaudoevocateur
authored andcommitted
fix(bootstrap): Run lifecycle scripts in topological queue instead of batches (#2224)
1 parent afb0414 commit d8d33f7

3 files changed

Lines changed: 11 additions & 27 deletions

File tree

commands/bootstrap/index.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,7 @@ const rimrafDir = require("@lerna/rimraf-dir");
1414
const hasNpmVersion = require("@lerna/has-npm-version");
1515
const npmInstall = require("@lerna/npm-install");
1616
const { createRunner } = require("@lerna/run-lifecycle");
17-
const batchPackages = require("@lerna/batch-packages");
18-
const runParallelBatches = require("@lerna/run-parallel-batches");
17+
const runTopologically = require("@lerna/run-topologically");
1918
const symlinkBinary = require("@lerna/symlink-binary");
2019
const symlinkDependencies = require("@lerna/symlink-dependencies");
2120
const ValidationError = require("@lerna/validation-error");
@@ -178,10 +177,6 @@ class BootstrapCommand extends Command {
178177
});
179178

180179
chain = chain.then(() => {
181-
this.batchedPackages = this.toposort
182-
? batchPackages(this.filteredPackages, this.options.rejectCycles)
183-
: [this.filteredPackages];
184-
185180
if (npmClient === "yarn" && !mutex) {
186181
return getPort({ port: 42424, host: "0.0.0.0" }).then(port => {
187182
this.npmConfig.mutex = `network:${port}`;
@@ -281,9 +276,14 @@ class BootstrapCommand extends Command {
281276

282277
tracker.addWork(this.filteredPackages.length);
283278

284-
return pFinally(runParallelBatches(this.batchedPackages, this.concurrency, mapPackageWithScript), () =>
285-
tracker.finish()
286-
);
279+
const runner = this.toposort
280+
? runTopologically(this.filteredPackages, mapPackageWithScript, {
281+
concurrency: this.concurrency,
282+
rejectCycles: this.options.rejectCycles,
283+
})
284+
: pMap(this.filteredPackages, mapPackageWithScript, { concurrency: this.concurrency });
285+
286+
return pFinally(runner, () => tracker.finish());
287287
}
288288

289289
hoistedDirectory(dependency) {

commands/bootstrap/package.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
"populate--": true
3737
},
3838
"dependencies": {
39-
"@lerna/batch-packages": "file:../../utils/batch-packages",
4039
"@lerna/command": "file:../../core/command",
4140
"@lerna/filter-options": "file:../../core/filter-options",
4241
"@lerna/has-npm-version": "file:../../utils/has-npm-version",
@@ -45,7 +44,7 @@
4544
"@lerna/pulse-till-done": "file:../../utils/pulse-till-done",
4645
"@lerna/rimraf-dir": "file:../../utils/rimraf-dir",
4746
"@lerna/run-lifecycle": "file:../../utils/run-lifecycle",
48-
"@lerna/run-parallel-batches": "file:../../utils/run-parallel-batches",
47+
"@lerna/run-topologically": "file:../../utils/run-topologically",
4948
"@lerna/symlink-binary": "file:../../utils/symlink-binary",
5049
"@lerna/symlink-dependencies": "file:../../utils/symlink-dependencies",
5150
"@lerna/validation-error": "file:../../core/validation-error",

package-lock.json

Lines changed: 1 addition & 16 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)