Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add graphql-tag support #5

Merged
merged 2 commits into from
Nov 14, 2022
Merged

feat: add graphql-tag support #5

merged 2 commits into from
Nov 14, 2022

Conversation

codeflyer
Copy link
Collaborator

@codeflyer codeflyer commented Nov 12, 2022

Add support for schema generated by graphql-tag

Why is this an important feature?

To integrate tools that help to organise the project

(Eg.)

    const {loadFiles} = require('@graphql-tools/load-files')
    
    const schema = await loadFiles(
      path.resolve(__dirname, '../modules/**/*.graphql')
    )

    const resolvers = (await loadFiles(
      path.resolve(__dirname, '../modules/**/resolvers.js')
    )).reduce((acc, resolver) => {
      Object.entries(resolver).forEach(([key, value]) => {
        if(!acc[key]) {
          acc[key] = {}
        }

        acc[key] = {...acc[key], ...value}
      })

      return acc
    }, {})

Copy link
Contributor

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 15b4a9e into main Nov 14, 2022
@mcollina mcollina deleted the feat/graphql-tag-support branch November 14, 2022 11:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants