authorgravatar for saiansh2525@gmail.comYash Singh <saiansh2525@gmail.com> 2026-10-06 04:14:28-05:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2026-10-06 04:14:28-05:00
log1f2b10c25bc400461e6c114c2c7236e91996225c
tree23e108e06a941c6e80e0192d215a1784da83d564
parenta7a2230c33fbec9d6616a5de26f09e1fa8856c05
signature Signed by PGP key B5690EEEBB952194

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


2 files changed, 29 insertions(+), 4 deletions(-)

scripts/lib/resolve-catalog.test.ts+23
......@@ -34,4 +34,27 @@ describe("resolveCatalogDependencies", () => {
3434 /Expected key 'missing' in root workspace catalog/,
3535 );
3636 });
37
38 it("resolves version-qualified overrides without changing their selectors", () => {
39 assert.deepStrictEqual(
40 resolveCatalogDependencies(
41 {
42 "undici@^8": "catalog:",
43 "ws@^8": "catalog:",
44 "@clerk/backend@^3": "catalog:",
45 "@scope/parent@^1>undici@^8": "catalog:",
46 "parent@^1>@clerk/backend@^3": "catalog:",
47 },
48 { ...catalog, undici: "8.11.2", ws: "8.21.0" },
49 "apps/desktop",
50 ),
51 {
52 "undici@^8": "8.11.2",
53 "ws@^8": "8.21.0",
54 "@clerk/backend@^3": "3.18.1",
55 "@scope/parent@^1>undici@^8": "8.11.2",
56 "parent@^1>@clerk/backend@^3": "3.18.1",
57 },
58 );
59 });
3760});
scripts/lib/resolve-catalog.ts+6-4
......@@ -32,10 +32,12 @@ export function resolveCatalogDependencies(
3232 }
3333
3434 const catalogKey = spec.slice("catalog:".length).trim();
35 // An override key can be a selector such as `@scope/parent>effect`; like
36 // pnpm, a bare `catalog:` there means the catalog entry of the package
37 // the selector ends in.
38 const lookupKey = catalogKey.length > 0 ? catalogKey : (name.split(">").at(-1) ?? name);
35 // Overrides can include a parent selector and a version range. A bare
36 // `catalog:` looks up the final package name, keeping its scope intact.
37 const selector = name.split(">").at(-1) ?? name;
38 const versionIndex = selector.indexOf("@", 1);
39 const packageName = versionIndex === -1 ? selector : selector.slice(0, versionIndex);
40 const lookupKey = catalogKey.length > 0 ? catalogKey : packageName;
3941 const resolved = catalog[lookupKey];
4042
4143 if (typeof resolved !== "string" || resolved.length === 0) {