Skip to content

Include catalog dependency changes when checking for changed packages#1220

Merged
ecraig12345 merged 2 commits intomainfrom
ecraig/proper-catalogs
Apr 29, 2026
Merged

Include catalog dependency changes when checking for changed packages#1220
ecraig12345 merged 2 commits intomainfrom
ecraig/proper-catalogs

Conversation

@ecraig12345
Copy link
Copy Markdown
Member

@ecraig12345 ecraig12345 commented Apr 28, 2026

Issue

Supposing a repo defines catalog/catalogs in .yarnrc.yml, and then it changes in a branch, e.g.:

  catalog:
-   react: ^18.0.0
+   react: ^19.0.0

The catalog dependency in a package looks like this in package.json, and by design, the file itself doesn't change:

{
  "name": "@scope/foo",
  "dependencies": {
    "react": "catalog:"
  }
}

With the initial implementation of catalog support in beachball, catalog-dependent packages like @scope/foo would not be listed as changed when the dependency's catalog version changes.

Fix

This PR updates the getChangedPackages logic to use a new function getCatalogChangedPackages which checks for catalog diffs:

  • If the repo defines catalogs and the file with the catalog definition has changed, it gets the catalog file content from the target branch and compares the catalog objects.
  • If there are any changes, it checks all included packages to get the list of packages using those catalog dependencies.

Most of the other changes are refactoring to support passing the previously-retrieved list of changed files to getCatalogChangedPackages, so we can skip the extra git operation of retrieving the file from the target branch if we already know it didn't change (which is by far the most common case). Removing one git operation doesn't matter much in small repos, but becomes important in extremely large repos.

@ecraig12345 ecraig12345 force-pushed the ecraig/proper-catalogs branch 5 times, most recently from 0bd8e17 to 8aa1e78 Compare April 29, 2026 07:56
Comment thread packages/beachball/src/__functional__/git/fetch.test.ts
Comment thread packages/beachball/src/git/ensureSharedHistory.ts
Comment thread packages/beachball/src/git/fetch.ts
Comment thread packages/beachball/src/changefile/getCatalogChangedPackages.ts
@ecraig12345 ecraig12345 force-pushed the ecraig/proper-catalogs branch from 8aa1e78 to b9a375a Compare April 29, 2026 21:33
@ecraig12345 ecraig12345 enabled auto-merge (squash) April 29, 2026 21:34
@ecraig12345 ecraig12345 merged commit 0f767eb into main Apr 29, 2026
10 checks passed
@ecraig12345 ecraig12345 deleted the ecraig/proper-catalogs branch April 29, 2026 21:42
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.

2 participants