Don't warn about mismatched versions when using multiple patches for the same library
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- node.js, typescript
- Domain
- tooling
Research direction
Start with dist/applyPatches.js and trace the version-mismatch warning path for patches whose versions contain a '+'. Verify that compatible multi-patch versions no longer warn while genuine version mismatches still do, then run the relevant project checks; the issue does not name a test file.
Written by the indexing model from the issue text.
Description
I just found out about https://github.com/ds300/patch-package/issues/43 which will make our patches really easy to work with by separating patches from each other. What a great feature!
Unfortunately we have enabled --error-on-warn to ensure we keep our patches up to date, and so the warnings we get from multi-patch names causes our builds to break.
I've patched patch-package with patch-package locally to skip + version patches, to work around this and avoid the warning. I'm sure there are some gotchas with the .includes('+') syntax I've used here (NPM versions that include the + character?) but I thought I should submit this as an issue to see whether it could be applied.
Here is the diff that solved my problem:
diff --git a/node_modules/patch-package/dist/applyPatches.js b/node_modules/patch-package/dist/applyPatches.js
index c0217cf..90f3eda 100644
--- a/node_modules/patch-package/dist/applyPatches.js
+++ b/node_modules/patch-package/dist/applyPatches.js
@@ -92,13 +92,19 @@ function applyPatchesForApp({ appPath, reverse, patchDir, shouldExitWithError, s
// yay patch was applied successfully
// print warning if version mismatch
if (installedPackageVersion !== version) {
- warnings.push(createVersionMismatchWarning({
- packageName: name,
- actualVersion: installedPackageVersion,
- originalVersion: version,
- pathSpecifier,
- path,
- }));
+ // Ignore multi-patch versions
+ if (version.includes('+') && version.split('+')[0] === installedPackageVersion) {
+ console.log("Ignoring multi-patch version mismatch for", pathSpecifier);
+ } else {
+ warnings.push(createVersionMismatchWarning({
+ packageName: name,
+ actualVersion: installedPackageVersion,
+ originalVersion: version,
+ pathSpecifier,
+ path,
+ }));
+
+ }
}
console.log(`${chalk_1.default.bold(pathSpecifier)}@${version} ${chalk_1.default.green("✔")}`);
}
This issue body was partially generated by patch-package ❤️
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 325
- PR merge metrics
- No merged PRs in 30d
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ds300/patch-package
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
ds300/patch-package#617 · 1 reaction ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ds300/patch-package#615 · 3 reactions ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
ds300/patch-package#216 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 25/100
ds300/patch-package#611 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
ds300/patch-package#610 · 2 comments · 1 reaction ·
All issues in ds300/patch-package
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·