Migrate to use patch-package instead of module augmentation #26
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.
Related:
#23
The goal of this PR is to use
patch-package
internals, wrapped with simple CLI that's being shipped with the core library.This will allow us to have better typings for libraries that isn't supporting this yet, just by running it as part of the
postinstall
script.The reason it's wrapped is because
patch-package
is for local patching, while here we would like to ship it as part of the package it self, and allow flexible transformation over the dependencies usingsemver
. For example - all range of3.0.0~3.0.2
or@apollo/client
works with the same patch.It also means that it's no longer required to have changes to
tsconfig.json
or need to use module augmentation - just by running the patch script it will make the code fully typed.Tested it for all available versions of
@apollo/client
and it works great. Testing became a bit more complex because we neednode_moduels
exists on the FS in order to test the effect of the patch on the TypeScript types.TODO:
@apollo/client
(v3) - for all features (direct usage of client, cache access, HOC, Data Component and hooks, different patches needed).graphql
-execute
andexecuteSync
- from 15.0.0 to 15.3.0 (different patches needed)apollo-cache
)patch-package
internally)react-apollo
apollo-angular
urql