Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/wild-schools-brake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@changesets/assemble-release-plan": patch

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

q: is only this package affected? or is the CLI affected too? or maybe is this problem "fixed up" in some other part of the code when CLI runs end to end?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think the bug is fixed up anywhere because we found some packages in production that hadn't been bumped as a result of this bug. The CLI is affected because it calls @changesets/assemble-release-plan.

Comment thread
Andarist marked this conversation as resolved.
Resolved
"@changesets/cli": patch
---

Fixed an issue with `none` release type sometimes overriding other release types and thus preventing a release from happening.
10 changes: 4 additions & 6 deletions packages/assemble-release-plan/src/flatten-releases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,10 @@ export default function flattenReleases(
changesets: [changeset.id]
};
} else {
// If the type was already major, we never need to update it
if (release.type === "minor" && type === "major") {
release.type = type;
} else if (
release.type === "patch" &&
(type === "major" || type === "minor")
if (
type === "major" ||
((release.type === "patch" || release.type === "none") &&
(type === "minor" || type === "patch"))
) {
release.type = type;
}
Expand Down
47 changes: 47 additions & 0 deletions packages/assemble-release-plan/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,53 @@ describe("assemble-release-plan", () => {
expect(releases[0].type).toEqual("major");
expect(releases[0].newVersion).toEqual("2.0.0");
});
it("`none` changeset should not override other release types", () => {
setup.addChangeset({
id: "big-cats-delight",
releases: [
{ name: "pkg-a", type: "none" },
{ name: "pkg-b", type: "none" },
{ name: "pkg-c", type: "none" }
]
});
setup.addChangeset({
id: "big-cats-wonder",
releases: [
{ name: "pkg-a", type: "patch" },
{ name: "pkg-b", type: "minor" },
{ name: "pkg-c", type: "major" }
]
});
setup.addChangeset({
id: "big-cats-yelp",
releases: [
{ name: "pkg-a", type: "none" },
{ name: "pkg-b", type: "none" },
{ name: "pkg-c", type: "none" }
]
Comment on lines +122 to +128

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in a way, this part is not really required for this test, but I guess it doesn't hurt it

});

let { releases } = assembleReleasePlan(
setup.changesets,
setup.packages,
defaultConfig,
undefined
);

expect(releases.length).toEqual(3);

expect(releases[0].name).toEqual("pkg-a");
expect(releases[0].type).toEqual("patch");
expect(releases[0].newVersion).toEqual("1.0.1");

expect(releases[1].name).toEqual("pkg-b");
expect(releases[1].type).toEqual("minor");
expect(releases[1].newVersion).toEqual("1.1.0");

expect(releases[2].name).toEqual("pkg-c");
expect(releases[2].type).toEqual("major");
expect(releases[2].newVersion).toEqual("2.0.0");
});
it("should assemble release plan with dependents", () => {
setup.updateDependency("pkg-b", "pkg-a", "^1.0.0");
setup.addChangeset({
Expand Down