Skip to content

Fix peer dep changelogs - #747

Closed
Blasz wants to merge 4 commits into
changesets:mainfrom
atlassian-forks:fix-peer-dep-changelogs
Closed

Fix peer dep changelogs#747
Blasz wants to merge 4 commits into
changesets:mainfrom
atlassian-forks:fix-peer-dep-changelogs

Conversation

@Blasz

@Blasz Blasz commented Feb 9, 2022

Copy link
Copy Markdown
Contributor

Fixes #746.

This also adds a new dependencyType argument to getDependencyReleaseLine to distinguish peer vs regular dependencies. We want to distinguish them because we currently output a shortened Updated dependencies message to prevent changelog noise from the sheer number of dependencies that our atlassian-frontend repo has. Peer dependency upgrades are more important as they trigger a major release and so we want to output the specific dependencies and their versions for peer upgrades and only peer upgrades.

@changeset-bot

changeset-bot Bot commented Feb 9, 2022

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7687aa6

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
@changesets/cli Minor
@changesets/types Minor
@changesets/apply-release-plan Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codesandbox-ci

codesandbox-ci Bot commented Feb 9, 2022

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 7687aa6:

Sandbox Source
Vanilla Configuration

@Blasz
Blasz force-pushed the fix-peer-dep-changelogs branch from e1dcaea to db6a2a2 Compare February 9, 2022 00:28
dependentReleases,
changelogOpts
changelogOpts,
"dependencies"

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.

If I read the code correctly this could actually be also caused by an optional dependency.

q: do you plan to utilize this new argument in your code?

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.

Releases only contain packages specified in the dependencies and peerDependencies fields of package.json so I don't think optional dependencies would be included here unless they were also specified in dependencies which isn't recommended behaviour.

We're planning to use it to distinguish peer dep upgrade lines from non-peer dep ones so that we output a more detailed message for major peer upgrades.

This distinction could also be made using a bumpType or isPeer argument instead.

updateInternalDependencies: "patch",
ignore: [],
___experimentalUnsafeOptions_WILL_CHANGE_IN_PATCH: {
onlyUpdatePeerDependentsWhenOutOfRange: false,

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.

Out of curiosity - so I assume that you are still using this default setting, doesn't it create major releases for you way too often?

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.

Yeah we are. It does for packages that have peer dependencies that upgrade frequently yes. The alternative though is that the minimum versions of peer dependency version ranges become stale which can break things, especially with aggressive de-duplication.

It probably is worth re-exploring though.

@n1ru4l

n1ru4l commented Mar 3, 2022

Copy link
Copy Markdown

I have another question that is potentially related to this PR.

I also noticed that changesets planned MAJOR releases, in which only PATCH updates were listed. After some research and finding this issue, I now understand that peerDependency updates are currently treated as MAJOR updates, but incorrectly listed as PATCH dependencies within the generated CHANGELOG.md file.

My first thought is that a peerDependency update should not automatically result in a MAJOR bump. In my perception the package that lists a package as a peerDependency should be bumped according to the version bump of the peerDependency 🤔 .

peer dependency major -> major bump of dependent
peer dependency minor -> minor bump of dependent
peer dependency patch -> patch bump of dependent

What is the current reason for treating each update of a peerDependency as a MAJOR change?

n1ru4l added a commit to graphql-hive/envelop that referenced this pull request Mar 3, 2022
n1ru4l added a commit to graphql-hive/envelop that referenced this pull request Mar 3, 2022
* chore: patch changesets for treating peer dependencies different (according to changesets/changesets#747 (comment))

* chore: update lockfile

* chore: bust cache?

* fix: remove restore keys and incoporate patches into cache key

* chore: change cache strategy
@kamilkisiela

Copy link
Copy Markdown

Two packages core and cli.
When core is bumped from 2.0.0 to 2.1.0 and cli depends on it in form of a version range ^2.0.0, it may or may not require a bump in version range.

a) changesets should try to be smart and safely bump the version range (major -> major, minor -> minor, patch -> patch)
b) or leave it entirely to the developer to decide

My 32 cents.

@GaboFDC

GaboFDC commented Jun 7, 2022

Copy link
Copy Markdown

Two packages core and cli. When core is bumped from 2.0.0 to 2.1.0 and cli depends on it in form of a version range ^2.0.0, it may or may not require a bump in version range.

a) changesets should try to be smart and safely bump the version range (major -> major, minor -> minor, patch -> patch) b) or leave it entirely to the developer to decide

My 32 cents.

This is exactly what #827 proposed as well

@dotansimha

Copy link
Copy Markdown
Contributor

Regarding this PR, @Blasz @n1ru4l @Andarist is there anything we can do to resolve the issues and get this merged? I can try to help :)

Spectryll407 added a commit to Spectryll407/Envelop-GraphQL that referenced this pull request Aug 19, 2025
* chore: patch changesets for treating peer dependencies different (according to changesets/changesets#747 (comment))

* chore: update lockfile

* chore: bust cache?

* fix: remove restore keys and incoporate patches into cache key

* chore: change cache strategy
@beeequeue

Copy link
Copy Markdown
Member

closing as stale, and because we are updating the bump type of peer dependents in #2090

@beeequeue beeequeue closed this Jun 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Peer dependency changelog lines are added under patch instead of major

8 participants