dotansimha / dotansimha/graphql-code-generator

[client-preset] potentially misleading error message

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

Description

### Problem

In the `codegen.ts` file you have to specify a directory for the generated code, like this:

```ts
const config: CodegenConfig = {
generates: {
'.output/gql/': {
// ...
},
},
}
```

However, it's now very clear that you have to end your path with "/". All the error message says is:

```
✖ [client-preset] target output should be a directory, ex: "src/gql/"
```

I spent a couple of minutes trying to figure it out until I came across this [discussion](https://github.com/dotansimha/graphql-code-generator/discussions/8684), where other user had the same issue.

### Solution

We could enhance the [error message](https://github.com/dotansimha/graphql-code-generator/blob/master/packages/presets/client/src/index.ts#L95) by mentioning the need for a trailing "/".

I already made a [fork with the suggested addition](https://github.com/luvejo/graphql-code-generator/blob/docs-enhance-error-message/packages/presets/client/src/index.ts#L95).

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.