dotansimha / dotansimha/graphql-code-generator

`@graphql-codegen/add` only adds text to `graphql.ts`

Open
#9,573 7 comments 10 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

### Which packages are impacted by your issue?

@graphql-codegen/client-preset

### Describe the bug

I want to add `// @ts-nocheck` to all files generated by `client-preset`.
However, when I use `@graphql-codegen/add`, it only adds to `graphql.ts`.

### Your Example Website or App

https://stackblitz.com/edit/stackblitz-starters-teuxdr?file=codegen.ts

### Steps to Reproduce the Bug or Issue

1. Open the example above
2. `npm run codegen`
3. Check the output in `./src/gql`
4. `// @ts-nocheck` is only added to `graphql.ts`

### Expected behavior

`// @ts-nocheck` is added to all files generated by `@graphql-codegen/client-preset`.

### Screenshots or Videos

_No response_

### Platform

- OS: StackBlitz
- NodeJS: v16.20.0
- `graphql` version: 16.7.1
- `@graphql-codegen/*` version(s):
- @graphql-codegen/add@5.0.0
- @graphql-codegen/cli@5.0.0
- @graphql-codegen/client-preset@4.1.0

### Codegen Config File

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

const config: CodegenConfig = {
overwrite: true,
schema: 'https://countries.trevorblades.com/graphql',
documents: 'src/**/!(*.d).{ts,tsx}',
generates: {
'src/gql/': {
preset: 'client',
plugins: [
{
add: {
content: '// @ts-nocheck',
},
},
],
},
},
};

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.