Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(bootstrap): Run lifecycle scripts in topological queue instead of batches #2224

Merged
merged 1 commit into from Oct 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 9 additions & 9 deletions commands/bootstrap/index.js
Expand Up @@ -14,8 +14,7 @@ const rimrafDir = require("@lerna/rimraf-dir");
const hasNpmVersion = require("@lerna/has-npm-version");
const npmInstall = require("@lerna/npm-install");
const { createRunner } = require("@lerna/run-lifecycle");
const batchPackages = require("@lerna/batch-packages");
const runParallelBatches = require("@lerna/run-parallel-batches");
const runTopologically = require("@lerna/run-topologically");
const symlinkBinary = require("@lerna/symlink-binary");
const symlinkDependencies = require("@lerna/symlink-dependencies");
const ValidationError = require("@lerna/validation-error");
Expand Down Expand Up @@ -178,10 +177,6 @@ class BootstrapCommand extends Command {
});

chain = chain.then(() => {
this.batchedPackages = this.toposort
? batchPackages(this.filteredPackages, this.options.rejectCycles)
: [this.filteredPackages];

if (npmClient === "yarn" && !mutex) {
return getPort({ port: 42424, host: "0.0.0.0" }).then(port => {
this.npmConfig.mutex = `network:${port}`;
Expand Down Expand Up @@ -281,9 +276,14 @@ class BootstrapCommand extends Command {

tracker.addWork(this.filteredPackages.length);

return pFinally(runParallelBatches(this.batchedPackages, this.concurrency, mapPackageWithScript), () =>
tracker.finish()
);
const runner = this.toposort
? runTopologically(this.filteredPackages, mapPackageWithScript, {
concurrency: this.concurrency,
rejectCycles: this.options.rejectCycles,
})
: pMap(this.filteredPackages, mapPackageWithScript, { concurrency: this.concurrency });

return pFinally(runner, () => tracker.finish());
}

hoistedDirectory(dependency) {
Expand Down
3 changes: 1 addition & 2 deletions commands/bootstrap/package.json
Expand Up @@ -36,7 +36,6 @@
"populate--": true
},
"dependencies": {
"@lerna/batch-packages": "file:../../utils/batch-packages",
"@lerna/command": "file:../../core/command",
"@lerna/filter-options": "file:../../core/filter-options",
"@lerna/has-npm-version": "file:../../utils/has-npm-version",
Expand All @@ -45,7 +44,7 @@
"@lerna/pulse-till-done": "file:../../utils/pulse-till-done",
"@lerna/rimraf-dir": "file:../../utils/rimraf-dir",
"@lerna/run-lifecycle": "file:../../utils/run-lifecycle",
"@lerna/run-parallel-batches": "file:../../utils/run-parallel-batches",
"@lerna/run-topologically": "file:../../utils/run-topologically",
"@lerna/symlink-binary": "file:../../utils/symlink-binary",
"@lerna/symlink-dependencies": "file:../../utils/symlink-dependencies",
"@lerna/validation-error": "file:../../core/validation-error",
Expand Down
17 changes: 1 addition & 16 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.