Skip to content

Commit

Permalink
fix: Use packageGraph.rawPackageList instead of misleading instance.f…
Browse files Browse the repository at this point in the history
…ilteredPackages

Also fixes mismatched filteredPackages.size (it's not a Set) in major version validation.
  • Loading branch information
evocateur committed Aug 20, 2018
1 parent 32357f8 commit 2e2abdc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
7 changes: 6 additions & 1 deletion commands/changed/index.js
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion commands/publish/index.js
Expand Up @@ -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,
Expand Down
17 changes: 9 additions & 8 deletions commands/version/index.js
Expand Up @@ -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"}`);
Expand Down Expand Up @@ -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 {
Expand All @@ -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;
Expand Down

0 comments on commit 2e2abdc

Please sign in to comment.