fix(release): resolve version-qualified catalog overrides (#16411)

This commit is contained in:
Yash Singh authored and GitHub committed 2026-10-06 04:14:28 -05:00
1 parent a7a2230c33
commit 1f2b10c25b
2 files changed
+29 -4

No files matched your search

+23
View File
@@ -34,4 +34,27 @@ describe("resolveCatalogDependencies", () => {
/Expected key 'missing' in root workspace catalog/,
);
});
it("resolves version-qualified overrides without changing their selectors", () => {
assert.deepStrictEqual(
resolveCatalogDependencies(
{
"undici@^8": "catalog:",
"ws@^8": "catalog:",
"@clerk/backend@^3": "catalog:",
"@scope/parent@^1>undici@^8": "catalog:",
"parent@^1>@clerk/backend@^3": "catalog:",
},
{ ...catalog, undici: "8.11.2", ws: "8.21.0" },
"apps/desktop",
),
{
"undici@^8": "8.11.2",
"ws@^8": "8.21.0",
"@clerk/backend@^3": "3.18.1",
"@scope/parent@^1>undici@^8": "8.11.2",
"parent@^1>@clerk/backend@^3": "3.18.1",
},
);
});
});
+6 -4
View File
@@ -32,10 +32,12 @@ export function resolveCatalogDependencies(
}
const catalogKey = spec.slice("catalog:".length).trim();
// An override key can be a selector such as `@scope/parent>effect`; like
// pnpm, a bare `catalog:` there means the catalog entry of the package
// the selector ends in.
const lookupKey = catalogKey.length > 0 ? catalogKey : (name.split(">").at(-1) ?? name);
// Overrides can include a parent selector and a version range. A bare
// `catalog:` looks up the final package name, keeping its scope intact.
const selector = name.split(">").at(-1) ?? name;
const versionIndex = selector.indexOf("@", 1);
const packageName = versionIndex === -1 ? selector : selector.slice(0, versionIndex);
const lookupKey = catalogKey.length > 0 ? catalogKey : packageName;
const resolved = catalog[lookupKey];
if (typeof resolved !== "string" || resolved.length === 0) {