From c7a58b201810b995e7f59dc3eee22cfa06c4c0c5 Mon Sep 17 00:00:00 2001 From: Jack Palmer Date: Tue, 4 Mar 2025 11:38:36 +0000 Subject: [PATCH] Bug fix: [repo-tools] generate-patch adds incompatible locator (#29046) * fix: Only encode the version for yarn patches Signed-off-by: Jack Palmer * chore: changeset Signed-off-by: Jack Palmer --------- Signed-off-by: Jack Palmer --- .changeset/silly-taxis-suffer.md | 5 +++++ .../src/commands/generate-patch/generate-patch.ts | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) create mode 100644 .changeset/silly-taxis-suffer.md diff --git a/.changeset/silly-taxis-suffer.md b/.changeset/silly-taxis-suffer.md new file mode 100644 index 0000000000..7763a70f39 --- /dev/null +++ b/.changeset/silly-taxis-suffer.md @@ -0,0 +1,5 @@ +--- +'@backstage/repo-tools': patch +--- + +Fix issue where generate-patch incorrectly encodes the locator not aligning with result of yarn patch 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 224b7ae4e6..10b31e0584 100644 --- a/packages/repo-tools/src/commands/generate-patch/generate-patch.ts +++ b/packages/repo-tools/src/commands/generate-patch/generate-patch.ts @@ -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