diff --git a/.changeset/strange-clocks-pretend.md b/.changeset/strange-clocks-pretend.md new file mode 100644 index 0000000000..9a3b6e20ac --- /dev/null +++ b/.changeset/strange-clocks-pretend.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +The `generate-patch` command will now fall back to always adding a `resolutions` entry, even if no matching descriptors are found. diff --git a/packages/repo-tools/src/commands/generate-patch/generate-patch.ts b/packages/repo-tools/src/commands/generate-patch/generate-patch.ts index e5d9928cea..3c33d9c1b0 100644 --- a/packages/repo-tools/src/commands/generate-patch/generate-patch.ts +++ b/packages/repo-tools/src/commands/generate-patch/generate-patch.ts @@ -217,8 +217,12 @@ async function loadTrimmedRootPkg(ctx: PatchContext, query?: string) { } return async (patchEntry?: string) => { - for (const descriptor of descriptors) { - resolutionsObj[descriptor] = patchEntry; + if (descriptors.length > 0) { + for (const descriptor of descriptors) { + resolutionsObj[descriptor] = patchEntry; + } + } else { + resolutionsObj[ctx.packageName] = patchEntry; } // We use the same patch for all versions of the package, if they don't // apply it might require manual intervention using the --query option