Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What, How & Why?
History
We've recently experienced a regression with package-lock integrity checks failed for our integration tests environments.
This was fixed with #2842 by removing the environments package locks.
I was personally opposed to this fix since it in my opinion introduces another substantial downside, that we won't be able to reproduce failures between our local setup and CI, since the packages will essentially install the latest compatible version of any package allowed by the semantic constraints in the environments package.json files. In particular, we would always be running our tests against latest React Native (if we didn't pin the version in the package.json file).
The root cause of the issue is a change we merged back in november of last year, which adds the "realm" and "realm-integration-tests" packages as path dependencies to packed archives. This introduced an issue where the integrity of the archive produced on CI wouldn't match the hash in the package-lock.json.
The workaround was a "preinstall" scripts that would install the archive and update the hashes in the lock before the actual install (or ci) ran.
This worked until I accidentally changed the preinstall script to run with
--no-save
because - well I forgot why I made it this way in the first place ...Why would the archives be dependencies in the first place?
Because a lot of tools, including electron-builder, CocoaPods
pod install
and the React Native Android Gradle files all depend on native modules being listed in dependencies for them to correctly bundle or install the packages.This PR
This replaces #2842 as an attempt to fix the original issue as well as addressing the concern around removing package-locks from the environment packages.
The idea is to introduce a shared script (peer-deps-as-deps.js) which will temporarily modify an environments package.json by moving its peer dependencies into its dependencies.
This script can be invoked with another command as a runtime argument that it will run and restore the package.json after it exits (or gets interrupted).
☑️ ToDos
Compatibility
label is updated or copied from previous entryBreaking
label has been applied or is not necessary