patch-package icon indicating copy to clipboard operation
patch-package copied to clipboard

Creating patch file for GitHub dependency fails

Open OmgImAlexis opened this issue 3 years ago • 4 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Closes #288

Here is the diff that solved my problem:

diff --git a/node_modules/patch-package/dist/getPackageResolution.js b/node_modules/patch-package/dist/getPackageResolution.js
index bc7ffaa..287a2f1 100644
--- a/node_modules/patch-package/dist/getPackageResolution.js
+++ b/node_modules/patch-package/dist/getPackageResolution.js
@@ -65,7 +65,7 @@ function getPackageResolution({ packageDetails, packageManager, appPath, }) {
         lockFileStack.reverse();
         const relevantStackEntry = lockFileStack.find((entry) => entry.dependencies && packageDetails.name in entry.dependencies);
         const pkg = relevantStackEntry.dependencies[packageDetails.name];
-        return pkg.resolved || pkg.from || pkg.version;
+        return pkg.resolved || pkg.version || pkg.from;
     }
 }
 exports.getPackageResolution = getPackageResolution;

This issue body was partially generated by patch-package.

OmgImAlexis avatar Jul 17 '21 03:07 OmgImAlexis

Thanks, stumbled on the same issue, this works well !

@ds300 could you merge this ?

QuentinFarizon avatar Sep 25 '21 14:09 QuentinFarizon

This fixed my problem as well! Please merge into main repo!

shoes22 avatar Nov 03 '21 12:11 shoes22

+1 Please merge.

mtwomey avatar May 17 '22 04:05 mtwomey

Might want to make a pull request for this to merge. This is just an issue.

dijonkitchen avatar Jul 21 '22 16:07 dijonkitchen

Works for me, thanks :)

bastienlm avatar Dec 23 '22 14:12 bastienlm