repo-tools: make generate-patch add global resolution entry as fallback

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-11-07 09:51:45 +01:00
parent a0f31e4b17
commit 3f1fb219bf
2 changed files with 11 additions and 2 deletions
+5
View File
@@ -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.
@@ -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