Skip to content

Commit b9a375a

Browse files
committed
feedback
1 parent 4737e33 commit b9a375a

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

packages/beachball/src/changefile/getCatalogChangedPackages.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,11 @@ export function getCatalogChangedPackages(params: {
6363

6464
const changedPackages: string[] = [];
6565

66+
const changedCatalogDepNames = [
67+
Object.keys(catalogsDiff.default || {}),
68+
Object.values(catalogsDiff.named || {}).map(catalog => Object.keys(catalog)),
69+
].flat(2);
70+
6671
for (const pkg of Object.values(packageInfos)) {
6772
// Skip logging exclude reasons for catalog references
6873
if (!isPackageIncluded(pkg, scopedPackages).isIncluded) continue;
@@ -74,8 +79,13 @@ export function getCatalogChangedPackages(params: {
7479
if (!deps) continue;
7580

7681
for (const [name, version] of Object.entries(deps)) {
77-
// See if this dep spec can be resolved from the catalog diff. If so, it's a change.
78-
if (getCatalogVersion({ name, version, catalogs: catalogsDiff, allowNotFound: true })) {
82+
// If this dep name might be one of the changed catalog dependencies, check if the version
83+
// specified in this package can be resolved from the catalog diff. If so, it's a change.
84+
// (it's possible some package could specify a non-catalog version of the same dep)
85+
if (
86+
changedCatalogDepNames.includes(name) &&
87+
getCatalogVersion({ name, version, catalogs: catalogsDiff, allowNotFound: true })
88+
) {
7989
changedDeps.push(name);
8090
}
8191
}

0 commit comments

Comments
 (0)