dotansimha / dotansimha/graphql-code-generator
Only first lifecycle hook runs
- Dominant language
- TypeScript
- Stars
- 11.3k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 23
Description
**Describe the bug**
When `beforeDone` lifecycle hook is a list, only the first hook runs
**To Reproduce**
Steps to reproduce the behavior:
1. My GraphQL schema:
```graphql
# Put your schema here
```
2. My GraphQL operations:
```graphql
# Put your operations here
```
3. My `codegen.yml` config file:
```yml
overwrite: true
schema:
- './packages/schema/schema/*.graphql'
documents:
# Shared fragments, used both by frontend and by backend tests
- ./packages/schema/fragments/*.gql
generates:
# Common types shared by backend, web frontend and mobile are generated in schema package
# Common validation schemas are also in schema package
./packages/schema/src/__generated__/types.ts:
# ...
config:
preResolveTypes: true
hooks:
afterAllFileWrite:
- prettier --write
beforeDone:
- touch a.txt
- touch b.txt
```
**Expected behavior**
I expect both files `a.txt` and `b.txt` to be created. However, only `a.txt` is created
**Environment:**
- OS: MacOS Catalina 10.15.7
- ``` "@graphql-codegen/add": "^2.0.2",
"@graphql-codegen/cli": "^1.21.5",
"@graphql-codegen/import-types-preset": "^1.18.2",
"@graphql-codegen/near-operation-file-preset": "^1.18.1",
"@graphql-codegen/typescript": "^1.22.1",
"@graphql-codegen/typescript-document-nodes": "^1.17.12",
"@graphql-codegen/typescript-operations": "^1.18.0",
"@graphql-codegen/typescript-react-apollo": "^2.2.5",
"@graphql-codegen/typescript-resolvers": "^1.19.2",
```
- NodeJS: 14.17.0
**Additional context**
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.