apollographql / apollographql/apollo-tooling
Add setting for ignoring/excluding a file pattern from
- Dominant language
- TypeScript
- Stars
- 3k
- Forks
- 460
- PR merge metrics
- No merged PRs in 30d
Description
## Problem:
[graphql-code-generator](https://graphql-code-generator.com/) can be configured to watch for changes in `.graphql`/`.gql` schema files and automatically generate Types and Hooks, to be used in a React+Typescript environment. It is described by [this article](https://significa.co/blog/generating-typescript-types-and-react-hooks-based-on-graphql-endpoint).
Graphql Queries/Mutations/Subscriptions can be defined inside a folder. Codegenerator then uses these definitions to build custom React hooks that map the exact shape of the query. The hook generated has the whole query definition inside a `gql` literal string tag.
The issue starts when Apollo Plugin attempts to parse this generated query. Since the project already have another query with the same name, as it was copied directly from the original definition, The Apollo Plugin crashes due to repeated query names.
## Solution:
Add the option to ignore files matching a certain pattern (Eg: `src/__auto_generated__/**`, `src/hooks/GeneratedHooks/**`).
Contributor guide
Research direction
No repository file or test is named. Start at the Apollo Plugin's discovery and parsing of .graphql/.gql files, then trace how configuration is passed to that entry point. Done means a configured pattern such as src/__auto_generated__/** prevents matching generated files from being parsed and avoids duplicate query-name failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, typescript
- Domain
- cli, tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100