Skip to content

Pre mode changeset will always be added into pre.json even if every package in that changeset is ignored #1050

Description

@gao-sun

Affected Packages

@changesets/cli

Maybe @changesets/assemble-release-plan @changesets/read

Noticed the result of assembleReleasePlan() always hold the full set of pre mode changesets.

Problem

Say we have two packages, @foo/a and @foo/b. Changesets is already in pre mode.

In pre.json:

{
  "mode": "pre",
  "tag": "beta",
  "initialVersions": {
    "@foo/a": "1.0.0-beta.1",
    "@foo/b": "1.0.0-beta.1"
  },
  "changesets": []
}

Now we have a changeset fifty-balloons-taste.md with the content:

---
"@foo/a": minor
---

Some update

And run:

changeset version --ignore @foo/a

Then fifty-balloons-taste.md will be added to the changesets field in pre.json.

If we commit the change then run changeset version, the changeset of @foo/a takes no effect and looks like it's lost.

However, in normal release mode, fifty-balloons-taste.md will not be removed after changeset version --ignore @foo/a; and if there's any changeset that includes the change of @foo/b, only that one will be removed and @foo/b will have version bump accordingly.

What happened in normal release mode is the desired behavior.

Proposed solution

Align pre mode's behavior with normal mode.

Additional context

We're trying to separate our packages into two groups and publish separately, since they may have different publish frequencies.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions