Skip to content

makePatch.js does not actually npm install the version that it says it is #320

Open
@jeffory-orrok

Description

@jeffory-orrok

Show of hands -- how many people have run patch-package on itself???

cat >patches/patch-package+6.4.7.patch
diff --git a/node_modules/patch-package/dist/makePatch.js b/node_modules/patch-package/dist/makePatch.js
index 985589e..326fae2 100644
--- a/node_modules/patch-package/dist/makePatch.js
+++ b/node_modules/patch-package/dist/makePatch.js
@@ -87,7 +87,7 @@ function makePatch({ packagePathSpecifier, appPath, packageManager, includePaths
             try {
                 // try first without ignoring scripts in case they are required
                 // this works in 99.99% of cases
-                spawnSafe_1.spawnSafeSync(`npm`, ["i", "--force"], {
+                spawnSafe_1.spawnSafeSync(`npm`, ["i", "--force", `${packageDetails.name}@${packageVersion}`], {
                     cwd: tmpRepoNpmRoot,
                     logStdErrOnError: false,
                     stdio: "ignore",
@@ -96,7 +96,7 @@ function makePatch({ packagePathSpecifier, appPath, packageManager, includePaths
             catch (e) {
                 // try again while ignoring scripts in case the script depends on
                 // an implicit context which we havn't reproduced
-                spawnSafe_1.spawnSafeSync(`npm`, ["i", "--ignore-scripts", "--force"], {
+                spawnSafe_1.spawnSafeSync(`npm`, ["i", "--ignore-scripts", "--force", `${packageDetails.name}@${packageVersion}`], {
                     cwd: tmpRepoNpmRoot,
                     stdio: "ignore",
                 });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions