Skip to content

fix: include missing peer depedency updates in changelogs - #1460

Open
breadadams wants to merge 6 commits into
changesets:mainfrom
breadadams:fix/missing-release-notes-for-peer-deps
Open

breadadams wants to merge 6 commits into
changesets:mainfrom
breadadams:fix/missing-release-notes-for-peer-deps

Conversation

@breadadams

@breadadams breadadams commented Sep 15, 2024 •

Copy link
Copy Markdown

@changeset-bot

changeset-bot Bot commented Sep 15, 2024 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: daf8ba3

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

This PR includes changesets to release 2 packages
Name Type
@changesets/apply-release-plan Patch
@changesets/cli 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

@codecov

codecov Bot commented Sep 15, 2024 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 81.03%. Comparing base (c867f32) to head (daf8ba3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1460      +/-   ##
==========================================
+ Coverage   81.02%   81.03%   +0.01%     
==========================================
  Files          54       54              
  Lines        2213     2215       +2     
  Branches      658      661       +3     
==========================================
+ Hits         1793     1795       +2     
  Misses        416      416              
  Partials        4        4              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@breadadams breadadams changed the title fix: include missing peer depedency updates in release notes fix: include missing peer depedency updates in changelogs Sep 15, 2024
Comment on lines 49 to 53
if (depType === "peerDependencies") {
shouldUpdate = !onlyUpdatePeerDependentsWhenOutOfRange;
shouldUpdate =
!onlyUpdatePeerDependentsWhenOutOfRange ||
updateInternalDependents === "always";
}

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.

hm... the alternative would be to say that peer dependencies are special (cause they kinda are...) and skip updating them altogether.

The reason why we have introduced updateInternalDependents === "always" was to make it easier for dependency updates to "flow" into their dependants. But with peers... that's not even a thing. A peer dependency and its peer dependant always form a kind of an implicit relationship. It's explicitly specified by the contract in the package.json but it's enforced in a way different way than with regular dependencies.

I also somewhat question if '*' range should work with updateInternalDependents === "always". But then I guess if it says always... then it means always 🤣 But again, this really was meant to work with ranges that specific some minimum compatible version and * is so loose.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I see where you're coming from. The fact that our packages are being bumped when a peer is bumped made me think this was intentional behaviour.

We actually have some custom logic running in a prepack script for all our packages (to fix that issue) which manually modifies the peer dep. versions from being "*" to the latest version of said dependency.

We did this because we're using the packages within a monorepo and on some projects that are (currently) outside of the monorepo. If we were to leave the "*" in the published version nothing forces us to update the peers when updating a package in one of our "outside-monorepo" projects.

We're not using ranges anywhere for our internal peer deps, because we ensure that whenever we update a package we also update its (internal) peer deps.

Having said that, this requirement might be specific to our use case - however like I say, since packages are bumped when a peer is, we took it as intentional behaviour and really dislike the empty changelogs 😕.

Comment on lines +2866 to +2867
- Updated dependencies
- pkg-b@1.2.1`);

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.

With * this is a big fat lie. The dependency itself was not updated. How we are even meant to reason about this?

When installing pkg-c@2.0.1 the package manager is free to leave pkg-b@1.2.0 in node_modules. It doesn't have to bother updating it because the * range says it's OK to leave it alone.

@breadadams breadadams Sep 17, 2024 •

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Oof, right, so this behaviour we're seeing could actually be considered a bug? 😅

As mentioned in my other comment, we sort of depend on it right now - and it works quite nicely, minus the empty changelogs entries.

There's no way for us to hook into this behaviour I believe? i.e. to make this functionality intentional on our side.

What about a new config option (maybe under experimental?) that when true would add a changelog entry for bumps due to peer dep. bumps... what do you think?

I get this is an important decision, but would love to have something thay solves our problem asap to stop getting these darn empty changelog entries 🥺.

@breadadams

breadadams commented Oct 23, 2024 •

Copy link
Copy Markdown
Author

Hey @Andarist, is there anything we can do to get this moving?

Whilst I understand your concerns expressed in the previous comments, these changes are only updating the "changelog logic" to match the "release logic" that is already implemented, i.e. using "*" versions with the updateInternalDependents: 'always' option does create new releases.

This branch has not been deployed

No deployments
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.

Empty changelog entries when using experimental options

2 participants