ds300 / ds300/patch-package

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

Open
#320 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.2k
Forks
325
PR merge metrics
No merged PRs in 30d

Description

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

```diff
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",
});
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.