GraphCommerce relies on patch-package ↗ to make modifications to GraphCommerce where there are no ways to modify through props or plugins.
yarn create-patch @graphcommerce/magento-store
- Get told in big red letters when the original file is changed and you need to check that your fix is still valid.
- Patches can be reviewed as part of your normal review process, local changes will slip though the cracks.
- The change is too consequential to be modified in place.
Nope. The technique is quite robust. Here are some things to keep in mind though:
- It's easy to forget to run yarn or npm when switching between branches that do and don't have patch files.
- Long lived patches can be costly to maintain if they affect an area of code that is updated regularly and you want to update the package regularly too.
- Big semantic changes can be hard to review. Keep them small and obvious or add plenty of comments.
- Changes can also impact the behaviour of other untouched packages. It's normally obvious when this will happen, and often desired, but be careful nonetheless.
- Make your changes to the file in node_modules.
- Run
yarn create-patch @graphcommerce/magento-storeto create a patch file.
- getting started