This gives more flexibility if the user fails to set up locally the subgraph.
The postinstall script will run subgraph-codegen. If it fails; it will exit with error code 1, which will fail in CI. Locally can be discarded and continue without major issue.
The failing config has a silent: true flag, to prevent throwing errors when the config is invalid, but that will only work if the codegen-cli script is not executed from a package.json script:
e.g.:
# this will work and exit silently
$ pnpm graphql-codegen --config ./src/subgraphs/codegen.ts
# this will exit with error code 1
$ pnpm subgraph-codegen
Steps:
(Required steps to reproduce or test the fix / feature)
Type of change:
[ ] New feature
[ ] Bug fix
[ ] Breaking change
[x] Enhancement
[x] Refactoring
[ ] Chore
How Has This Been Tested?
[x] Manual testing
[ ] Automated tests
[ ] Other (explain)
Remember to check that:
Your code follows the style guidelines of this project
You have performed a self-review of your code
You have commented your code in hard-to-understand areas
You have made corresponding changes to the documentation
Description:
This gives more flexibility if the user fails to set up locally the subgraph.
The
postinstall
script will runsubgraph-codegen
. If it fails; it will exit with error code1
, which will fail in CI. Locally can be discarded and continue without major issue.The failing config has a
silent: true
flag, to prevent throwing errors when the config is invalid, but that will only work if the codegen-cli script is not executed from apackage.json
script:e.g.:
Steps:
(Required steps to reproduce or test the fix / feature)
Type of change:
How Has This Been Tested?
Remember to check that:
Screenshots
https://github.com/user-attachments/assets/4e281fda-3ffd-4023-bfb8-b385590aa446