dotansimha / dotansimha/graphql-code-generator

ESM TS usage docs use different codegen file than repo example

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

Description

### Describe the bug

[In the docs](https://www.the-guild.dev/graphql/codegen/docs/getting-started/esm-typescript-usage#codegen-configuration) the codegen file is a TypeScript file (`codegen.ts`).

The same page references code example links twice. Both links point to code example that doesn't use a TypeScript file for codegen, instead it uses a yaml file: https://github.com/dotansimha/graphql-code-generator/blob/master/examples/typescript-esm/codegen.yml

Is there an actual example where a TypeScript codegen file is used instead of yaml?

### Your Example Website or App

https://github.com/dotansimha/graphql-code-generator/blob/master/examples/typescript-esm/codegen.yml

### Steps to Reproduce the Bug or Issue

1. Look at docs https://www.the-guild.dev/graphql/codegen/docs/getting-started/esm-typescript-usage#codegen-configuration
2. Look at referenced code example https://github.com/dotansimha/graphql-code-generator/blob/master/examples/typescript-esm/codegen.yml
3. Observe that code example doesn't use same config file type as docs.

### Expected behavior

Code example should use same config file type as docs.

### Screenshots or Videos

CleanShot 2022-10-05 at 13 38 26@2x

CleanShot 2022-10-05 at 13 37 30@2x

### Platform

- OS: macOS
- NodeJS: 18.5.0
- `graphql` version: 16.6.0
- `@graphql-codegen/cli` version(s): [e.g. 2.13.4

### Codegen Config File

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

export const config: CodegenConfig = {
schema: 'http://localhost:8080/v1/graphql',
emitLegacyCommonJSImports: false,
generates: {
'./generated/gql': {
plugins: ['typescript', 'typescript-operations', 'typescript-resolvers'],
preset: 'gql-tag-operations-preset',
},
},
watch: true,
watchConfig: {
usePolling: true,
interval: 1000,
},
};

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.