Sometimes you'll need patch one of the Orion npm dependencies. For example, you may want to change the Apollo configuration of Orion's GraphQL server which is spawned by the @subsquid/graphql-server
dependency.
As a temporary solution, you can use the patch-package
tool (which has already been used to patch a few dependencies in Orion) in order to achieve this.
The way it works is:
- You modify the dependency's code inside
node_modules
(e.g.node_modules/@subsquid/graphql-server/lib/server.js
) - You run
npx patch-package [PACKAGE_NAME] --patch-dir assets/patches
, where[PACKAGE_NAME]
is the name of the dependency you want to patch (e.g.@subsquid/graphql-server
) - The
patch-package
tool will create/update a patch file insideassets/patches
which will apply your changes every time the dependencies are installed (because of thepostinstall
script inpackage.json
)