- 
                Notifications
    You must be signed in to change notification settings 
- Fork 148
Update patch-package (fix remaining source of seemingly random ENOENT error) #1739
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
a4c244b    to
    de7ee4f      
    Compare
  
    There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The renaming of some patch files from .patch to .dev.patch is explained at:
https://www.npmjs.com/package/patch-package#dev-only-patches
| + 'package.json', | ||
| + 'patches', | ||
| + 'patches0', | ||
| + 'typings', | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The modifications to this patch file (@oclif+dev-cli+1.22.0.patch) are:
- Reformatted the sourcesarray entries in alphabetical order, with one entry per line.
- Added folder patches0to thesourcesarray entries. This is a new folder being added to the CLI repo in this PR. (See other comment.)
- Recreated the patch file in the usual way, in order to update the commit hashes and line numbers:
npx patch-package \@oclif/dev-cli
- Renamed the patch file to .dev.patch(as required by the new version of patch-package, to avoid warnings/errors).
| }, | ||
| "scripts": { | ||
| "postinstall": "patch-package", | ||
| "postinstall": "patch-package --patch-dir patches0 && patch-package", | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As suggested in ds300/patch-package#203 (comment)
| // yay patch was applied successfully | ||
| // print warning if version mismatch | ||
| - if (installedPackageVersion !== version) { | ||
| + if (installedPackageVersion !== version.replace(/\.dev$/, "")) { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- This patch "solves" issue Mismatched version warning for identical versions (.patch vs .dev.patch) ds300/patch-package#201 and replicates upstream PR Ignore ".dev" suffix when deciding on package version mismatch ds300/patch-package#224
- It was added to a new separate folder 'patches0'instead of the existing usual'patches'folder so thatpatch-packagecan patch itself before being used to apply other patches (patch-package should support patching itself inpostinstallscript ds300/patch-package#203 (comment)). The zero at the end ofpatches0was meant to convey the idea that it comes first, at the very beginning, liket0in physics...
| @balena-ci retest | 
de7ee4f    to
    3f9dcf2      
    Compare
  
    | @balena-ci retest | 
… error) Connects-to: #1723 Change-type: patch
3f9dcf2    to
    e3c42cf      
    Compare
  
    
This PR arranges for
patch-packageto patch itself before applying other patches (as suggested in ds300/patch-package#203 (comment)). This is necessary (desirable) in order to fix the remaining (theoretical) occurrence of "random ENOENT" described in #1723, and also to allowpatch-packageto be updated without facing issue ds300/patch-package/issues/201. As a bonus, a number of old dependencies are are removed from production installations of balena-cli: see diff fornpm-shrinkwrap.json.I tried getting it resolved upstream before putting together this PR, but so far without success:
postinstallscript ds300/patch-package#203Connects-to: #1723
Change-type: patch