Skip to content

fix: list optionalDependencies in the updated dependencies changelog - #2394

Open
mixelburg wants to merge 1 commit into
changesets:mainfrom
mixelburg:fix/changelog-optional-dependencies
Open

mixelburg wants to merge 1 commit into
changesets:mainfrom
mixelburg:fix/changelog-optional-dependencies

Conversation

@mixelburg

Copy link
Copy Markdown
Contributor

getDependencyVersionEdits rewrites an internal dependency's range in all four dependency maps, including optionalDependencies, and the dependents graph that assemble-release-plan uses also includes optionalDependencies. So a package that only optionally depends on a released package is bumped and its range is rewritten.

getChangelogEntry only looked at dependencies and peerDependencies, so these releases ended up in the changelog as:

## 1.0.4

No changes in this release.

— with no hint that the optional dependency was updated, even though package.json now says ~1.2.1. This checks optionalDependencies too and passes the matching depType to shouldUpdateDependencyBasedOnConfig, so the changelog uses exactly the same range rules as the rewrite.

Added a regression test: pkg-a has no changeset of its own, only optionalDependencies: { "pkg-b": "~1.2.0" }, and pkg-b is patched. Before the change the changelog reads "No changes in this release."; after it lists pkg-b@1.2.1 under Updated dependencies. Full suite: 809 tests, 807 passed, 0 failed.

Related: #1460 covers the same gap for peerDependencies and is now stale/conflicting — peer dependencies are already handled on main.

@netlify

netlify Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

👷 Deploy request for changesets pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 3529dcc

@changeset-bot

changeset-bot Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3529dcc

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 Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.73%. Comparing base (704f329) to head (3529dcc).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2394      +/-   ##
==========================================
+ Coverage   87.71%   87.73%   +0.02%     
==========================================
  Files          81       81              
  Lines        2987     2993       +6     
  Branches      853      858       +5     
==========================================
+ Hits         2620     2626       +6     
  Misses        331      331              
  Partials       36       36              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

`getDependencyVersionEdits` rewrites the range of an internal dependency in all
four dependency maps (`dependencies`, `devDependencies`, `peerDependencies`,
`optionalDependencies`), and the dependents graph used by `assemble-release-plan`
also includes `optionalDependencies`, so a package that only optionally depends
on a released package is bumped and its range is rewritten.

`getChangelogEntry` however only looked at `dependencies` and `peerDependencies`,
so those releases were documented as "No changes in this release." with no hint
that the optional dependency was updated.

Check `optionalDependencies` as well, between `dependencies` and
`peerDependencies`, and pass the matching `depType` to
`shouldUpdateDependencyBasedOnConfig` so the range rules stay identical to the
ones used for the rewrite itself.
@mixelburg
mixelburg force-pushed the fix/changelog-optional-dependencies branch from 8693b4d to 3529dcc Compare November 21, 2026 22:09

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.

1 participant