ds300 / patch-package

Fix broken node modules instantly 🏃🏽‍♀️💨
MIT License
10.44k stars 295 forks source link

Creating patch file for GitHub dependency fails #335

Closed OmgImAlexis closed 1 year ago

OmgImAlexis commented 3 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch patch-package@6.4.7 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.

QuentinFarizon commented 3 years ago

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

@ds300 could you merge this ?

shoes22 commented 3 years ago

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

mtwomey commented 2 years ago

+1 Please merge.

dijonkitchen commented 2 years ago

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

bastienlm commented 1 year ago

Works for me, thanks :)