Skip to content

Commit f6d3b86

Browse files
committed
fix: reapplyBumpTypes accepts both name and packageKey formats
Keys containing :: are matched by exact packageKey; plain names match all packages with that name (for fixed/linked group propagation).
1 parent 9b8ca3e commit f6d3b86

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/pubm/src/commands/version-cmd.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -245,15 +245,19 @@ function extractBumpTypes(
245245
}
246246

247247
/**
248-
* Writes name-keyed bump types back to the packageKey-keyed bumps map.
248+
* Writes bump types back to the packageKey-keyed bumps map.
249+
* Keys can be either package names or packageKeys (path::ecosystem).
250+
* A packageKey matches exactly one package; a name may match multiple.
249251
*/
250252
function reapplyBumpTypes(
251253
bumps: Map<string, VersionBump>,
252254
bumpTypes: Map<string, BumpType>,
253255
packages: ResolvedPackageConfig[],
254256
): void {
255-
for (const [name, bumpType] of bumpTypes) {
256-
const matchingPkgs = packages.filter((p) => p.name === name);
257+
for (const [key, bumpType] of bumpTypes) {
258+
const matchingPkgs = key.includes("::")
259+
? packages.filter((p) => packageKey(p) === key)
260+
: packages.filter((p) => p.name === key);
257261
for (const pkg of matchingPkgs) {
258262
const pkgKey = packageKey(pkg);
259263
const existing = bumps.get(pkgKey);

packages/pubm/tests/unit/commands/add.test.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,7 @@ describe("registerAddCommand", () => {
260260
await parent.parseAsync(["node", "test", "add"]);
261261

262262
const firstCall = mockEnquirerPrompt.mock.calls[0][0];
263-
expect(firstCall.initial).toEqual(
264-
packages.map((pkg) => `${pkg.path}::js`),
265-
);
263+
expect(firstCall.initial).toEqual(packages.map((pkg) => `${pkg.path}::js`));
266264
expect(firstCall.choices).not.toContainEqual(
267265
expect.objectContaining({ enabled: true }),
268266
);

0 commit comments

Comments
 (0)