From 2e2abdc2701ffb6e1aef3a75cfb3c27d2f114cb3 Mon Sep 17 00:00:00 2001 From: Daniel Stockman Date: Mon, 20 Aug 2018 14:00:34 -0700 Subject: [PATCH] fix: Use packageGraph.rawPackageList instead of misleading instance.filteredPackages Also fixes mismatched filteredPackages.size (it's not a Set) in major version validation. --- commands/changed/index.js | 7 ++++++- commands/publish/index.js | 2 +- commands/version/index.js | 17 +++++++++-------- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/commands/changed/index.js b/commands/changed/index.js index 4b168666d4..740cff41a3 100644 --- a/commands/changed/index.js +++ b/commands/changed/index.js @@ -18,7 +18,12 @@ class ChangedCommand extends Command { } initialize() { - const updates = collectUpdates(this.filteredPackages, this.packageGraph, this.execOpts, this.options); + const updates = collectUpdates( + this.packageGraph.rawPackageList, + this.packageGraph, + this.execOpts, + this.options + ); this.result = listable.format(updates.map(node => node.pkg), this.options); diff --git a/commands/publish/index.js b/commands/publish/index.js index a15a610a9a..3755a06412 100644 --- a/commands/publish/index.js +++ b/commands/publish/index.js @@ -205,7 +205,7 @@ class PublishCommand extends Command { // find changed packages since last release, if any chain = chain.then(() => - collectUpdates(this.filteredPackages, this.packageGraph, this.execOpts, { + collectUpdates(this.packageGraph.rawPackageList, this.packageGraph, this.execOpts, { bump: "prerelease", canary: true, ignoreChanges, diff --git a/commands/version/index.js b/commands/version/index.js index 0d2f039d96..f003babf2a 100644 --- a/commands/version/index.js +++ b/commands/version/index.js @@ -128,7 +128,12 @@ class VersionCommand extends Command { return false; } - this.updates = collectUpdates(this.filteredPackages, this.packageGraph, this.execOpts, this.options); + this.updates = collectUpdates( + this.packageGraph.rawPackageList, + this.packageGraph, + this.execOpts, + this.options + ); if (!this.updates.length) { this.logger.success(`No changed packages to ${this.composed ? "publish" : "version"}`); @@ -298,7 +303,7 @@ class VersionCommand extends Command { } setUpdatesForVersions(versions) { - if (this.project.isIndependent() || versions.size === this.filteredPackages.size) { + if (this.project.isIndependent() || versions.size === this.packageGraph.size) { // only partial fixed versions need to be checked this.updatesVersions = versions; } else { @@ -309,12 +314,8 @@ class VersionCommand extends Command { } if (hasBreakingChange) { - const packages = - this.filteredPackages.length === this.packageGraph.size - ? this.packageGraph - : new Map(this.filteredPackages.map(({ name }) => [name, this.packageGraph.get(name)])); - - this.updates = Array.from(packages.values()); + // _all_ packages need a major version bump whenever _any_ package does + this.updates = Array.from(this.packageGraph.values()); this.updatesVersions = new Map(this.updates.map(({ name }) => [name, this.globalVersion])); } else { this.updatesVersions = versions;