-
-
Notifications
You must be signed in to change notification settings - Fork 313
Closed
Labels
Description
Use case
We are using patch-package to fix some nasty dependency issues, it works great during development. But it sometimes causes CircleCI failures when a partially patched node_modules folder is cached by CI.
The issue
- Install
patch-packageand add it aspreparescript, as instructed by README. - Patch module
foo-barusingpatch-package foo-bar. Commit the resultedpatches/foo-bar+X.X.X.patchto repo. - When CI is run, CircleCI installs and patches the
node_modulesfolder and saves the result to cache. - Modify module
foo-barand regenerate patch file. - CircleCI restores the previous cached
node_modulesfolder (which has incorporated previous version of the patch). - CircleCI fails when applying new patch to
node_modules:
**ERROR** Failed to apply patch for package foo-bar
This error was caused because Git cannot apply the following patch file:
patches/foo-bar+X.X.X.patch
This is usually caused by inconsistent whitespace in the patch file.
Proposed solutions
-
Add a checksum file for the
patchesfolder so we can easily check if patches has been changed before restoring cache from CI. -
Or, add a operation that can revert applied patches, such as
patch-package revert. So we can revert the patches and save the cleannode_modulesfolder to cache.
dinvlad, fabiencelier, OliverJAsh and bombillazo