Bug fix: [repo-tools] generate-patch adds incompatible locator (#29046)

* fix: Only encode the version for yarn patches

Signed-off-by: Jack Palmer <jackpalmer@spotify.com>

* chore: changeset

Signed-off-by: Jack Palmer <jackpalmer@spotify.com>

---------

Signed-off-by: Jack Palmer <jackpalmer@spotify.com>
This commit is contained in:
Jack Palmer
2025-03-04 11:38:36 +00:00
committed by GitHub
parent b62de757ab
commit c7a58b2018
2 changed files with 6 additions and 6 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/repo-tools': patch
---
Fix issue where generate-patch incorrectly encodes the locator not aligning with result of yarn patch
@@ -254,12 +254,7 @@ async function generatePatch(
await fs.writeFile(joinPath(patchDir, name), patch, 'utf8');
const locator = `${ctx.sourcePkg.packageJson.name}@npm:${version}`;
return `patch:${encodeURIComponent(locator)}#${posix.join(
'.',
'.yarn',
'patches',
name,
)}`;
return `patch:${locator}#${posix.join('.', '.yarn', 'patches', name)}`;
}
// Check if an existing resolution entry is a patch, and in that case return the