Skip to content

Conversation

@pdcastro
Copy link
Contributor

This PR arranges for patch-package to 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 allow patch-package to 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 for npm-shrinkwrap.json.

I tried getting it resolved upstream before putting together this PR, but so far without success:

Connects-to: #1723
Change-type: patch

@pdcastro pdcastro force-pushed the 1723-update-patch-package branch 2 times, most recently from a4c244b to de7ee4f Compare April 20, 2020 23:23
Copy link
Contributor Author

@pdcastro pdcastro left a 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',
Copy link
Contributor Author

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 sources array entries in alphabetical order, with one entry per line.
  • Added folder patches0 to the sources array 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

},
"scripts": {
"postinstall": "patch-package",
"postinstall": "patch-package --patch-dir patches0 && patch-package",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

// yay patch was applied successfully
// print warning if version mismatch
- if (installedPackageVersion !== version) {
+ if (installedPackageVersion !== version.replace(/\.dev$/, "")) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pdcastro
Copy link
Contributor Author

@balena-ci retest

@pdcastro pdcastro marked this pull request as ready for review April 21, 2020 01:21
@pdcastro pdcastro force-pushed the 1723-update-patch-package branch from de7ee4f to 3f9dcf2 Compare April 21, 2020 22:44
@pdcastro
Copy link
Contributor Author

@balena-ci retest

@pdcastro pdcastro force-pushed the 1723-update-patch-package branch from 3f9dcf2 to e3c42cf Compare April 22, 2020 10:46
@pdcastro pdcastro merged commit 028141c into master Apr 22, 2020
@pdcastro pdcastro deleted the 1723-update-patch-package branch April 22, 2020 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants