feat: extend file pattern for node_modules cache with package.json entries
What does this MR do and why?
It is not enough to watch for changes on yarn.lock only when invalidating node_modules cache. Scenarios can be different. For example if yarn.lock is the same, but in package.json we, let's say, moved packages from dependencies to devDependencies (or the other way around), the cache won't be invalidated. But it should - otherwise the wrong packages will be pulled in when we build for production.
This MR is using the allowed glob pattern to define the watched files to include both file types from the host and from the FE island.
The local testing result
The test can be run with ruby scripts/lib/node_modules_sha.rb to ensure the hash gets correctly updated when the right files are updated.
On the screenshot:
- the first run without any changes to
package.jsonoryarn.lock - the second -
ee/frontend_islands/apps/duo_next/package.jsongot changed. The changes were reverted to not mess the following tests - the third -
package.jsonon the root got changed.The changes were reverted to not mess the following tests - the fourth - no changes again (both
package.jsonfiles were reverted). Note the hash is identical to the very first one which is correct and expected
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
