dotansimha / dotansimha/graphql-code-generator-community

@graphql-codegen/typescript-mongodb doesn't work without graphql-tag dependency

Open
#230 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
137
Forks
195
Avg merge
6h 20m
Merged PRs (30d)
16

Description

### Describe the bug

Without the `graphql-tag` direct dependency, I'm getting the following error when running `graphql-codegen`:

```
Unable to find template plugin matching typescript-mongodb
```

Might be good to indicate the `graphql-tag` direct dependency is required, otherwise the error doesn't really help the user figure out what is wrong.

### Your Example Website or App

N/A

### Steps to Reproduce the Bug or Issue

1. Install the codegen packages for @graphql-codegen/typescript-mongodb (without `graphql-tag` as a direct dependency)
2. Attempt to generate codegen for mongodb
3. See error listed above
4. Add `graphql-tag` as a direct dependency
5. Verify error does not happen and codegen completes successfully

### Expected behavior

@graphql-codegen/typescript-mongodb should either work without needing to explicitly list `graphql-tag` as direct dependency, or update error/docs to more clearly tell the user that `graphql-tag` is required as a direct dependency.

### Screenshots or Videos

_No response_

### Platform

- OS: Windows 11
- NodeJS: v16.13.2
- `graphql` version: 16.6.0
- `@graphql-codegen/*` version(s):
- "@graphql-codegen/typescript-mongodb": "2.4.5",
- "@graphql-codegen/cli": "2.12.0",
- "@graphql-codegen/typescript": "2.7.3",
- "@graphql-codegen/typescript-operations": "2.5.5",
- "@graphql-codegen/typescript-react-apollo": "3.3.5",
- "@graphql-codegen/typescript-resolvers": "2.7.3",

### Codegen Config File

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

const config: CodegenConfig = {
schema: 'src/graphql/schema.ts',
generates: {
'src/graphql/generated-typings.ts': {
plugins: ['typescript', 'typescript-resolvers'],
},
'src/database/generated-typings.ts': {
plugins: ['typescript', 'typescript-mongodb'],
},
'../ui/libs/client/src/graphql/generated-typings.tsx': {
documents: ['../ui/libs/client/src/graphql/*.gql'],
plugins: ['typescript', 'typescript-operations', 'typescript-react-apollo'],
},
},
}

export default config

### Additional context

Loving the codegen functionality otherwise, it's a great tool for single source of truth development!

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.