dotansimha / dotansimha/graphql-code-generator

Output level lifecycle hooks don't run

Open
#8,574 3 comments 1 reaction 0 assignees View on GitHub
core
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Describe the bug

Output level lifecycle hook configurations do not run

### Your Example Website or App

https://codesandbox.io/s/determined-goldwasser-1w4r7o

### Steps to Reproduce the Bug or Issue

1. Configure codegen.ts with an output level lifecycle hook (specifically prettier in my example)
2. run codegen
3. observe that the formatting rules do not get applied

### Expected behavior

I expect the afterAllFileWrite hook to run the command I've specified for the generated files (i.e. the output files are formatted)

### Screenshots or Videos

_No response_

### Platform

- OS: macOS
- NodeJS: 16.13
- `graphql` version: 15.5.0
- `@graphql-codegen/*` version(s): 2.13.7

### Codegen Config File

```ts
import type { CodegenConfig } from '@graphql-codegen/cli'

const config: CodegenConfig = {
overwrite: true,
schema: 'http://localhost:4000/graphql',
documents: 'src/**/*.{ts,tsx}',
ignoreNoDocuments: true,
generates: {
'./src/gql/': {
preset: 'client',
plugins: [],
hooks: { afterAllFileWrite: ['prettier --write'] },
},
'graphql.schema.json': {
plugins: ['introspection'],
config: { minify: true },
},
},
}

export default config
```

### Additional context

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.