Skip to content

Commit

Permalink
feat(version): Add just-in-time queue management
Browse files Browse the repository at this point in the history
  • Loading branch information
evocateur committed May 13, 2019
1 parent 23736e5 commit 290539b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
16 changes: 7 additions & 9 deletions commands/version/index.js
Expand Up @@ -17,7 +17,7 @@ const PromptUtilities = require("@lerna/prompt");
const output = require("@lerna/output");
const collectUpdates = require("@lerna/collect-updates");
const { createRunner } = require("@lerna/run-lifecycle");
const batchPackages = require("@lerna/batch-packages");
const runTopologically = require("@lerna/run-topologically");
const ValidationError = require("@lerna/validation-error");
const { createGitHubClient, parseGitRepo } = require("@lerna/github-client");
const prereleaseIdFromVersion = require("@lerna/prerelease-id-from-version");
Expand Down Expand Up @@ -238,7 +238,6 @@ class VersionCommand extends Command {
const tasks = [
() => this.getVersionsForUpdates(),
versions => this.setUpdatesForVersions(versions),
() => this.setBatchUpdates(),
() => this.confirmVersions(),
];

Expand Down Expand Up @@ -441,11 +440,8 @@ class VersionCommand extends Command {
this.updatesVersions = versions;
}
}
}

setBatchUpdates() {
this.packagesToVersion = this.updates.map(({ pkg }) => pkg);
this.batchedPackages = batchPackages(this.packagesToVersion, this.options.rejectCycles);
}

confirmVersions() {
Expand Down Expand Up @@ -552,10 +548,12 @@ class VersionCommand extends Command {
const mapUpdate = pPipe(actions);

chain = chain.then(() =>
pReduce(this.batchedPackages, (_, batch) =>
// TODO: tune the concurrency?
pMap(batch, mapUpdate, { concurrency: 100 })
)
runTopologically({
packages: this.packagesToVersion,
concurrency: this.concurrency,
rejectCycles: this.options.rejectCycles,
runner: mapUpdate,
})
);

if (!independentVersions) {
Expand Down
1 change: 1 addition & 0 deletions commands/version/package.json
Expand Up @@ -45,6 +45,7 @@
"@lerna/prerelease-id-from-version": "file:../../utils/prerelease-id-from-version",
"@lerna/prompt": "file:../../core/prompt",
"@lerna/run-lifecycle": "file:../../utils/run-lifecycle",
"@lerna/run-topologically": "file:../../utils/run-topologically",
"@lerna/validation-error": "file:../../core/validation-error",
"chalk": "^2.3.1",
"dedent": "^0.7.0",
Expand Down
1 change: 1 addition & 0 deletions package-lock.json

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

0 comments on commit 290539b

Please sign in to comment.