eddeee888 / graphql-code-generator-plugins

List of GraphQL Code Generator plugins that complements the official plugins.
MIT License
51 stars 12 forks source link

Generate typeDef file #51

Closed eddeee888 closed 1 year ago

eddeee888 commented 1 year ago

This generates an typeDefs.generated.ts file that contains the Schema AST as DocumentNode.

This file can be used without using external libs or looking through the filesystem for schemas at runtime:

import { createServer } from '@graphql-yoga/node'
import { typeDefs } from './schema/typeDefs.generated' // Now generated and can be used statically 🎉 
import { resolvers } from './schema/resolvers.generated'

const server = createServer({ typeDefs, resolvers })

server.start()

To opt-out, update the Codegen config:

generates:
  src/schema:
    preset: '@eddeee888/gcg-typescript-resolver-files'
    presetConfig:
      typeDefsFilePath: false # Add this line to avoid generating typeDefs file
changeset-bot[bot] commented 1 year ago

🦋 Changeset detected

Latest commit: f19d84171b402c4482fdf291bf332a9490fcf6eb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | ---------------------------------------- | ----- | | @eddeee888/gcg-typescript-resolver-files | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

eddeee888 commented 1 year ago

/release-snapshot

github-actions[bot] commented 1 year ago

✅ Successfully published package/s with tag pr51-run73-1!

eddeee888 commented 1 year ago

/release-snapshot

github-actions[bot] commented 1 year ago

✅ Successfully published package/s with tag pr51-run75-1!

eddeee888 commented 1 year ago

/release-snapshot

eddeee888 commented 1 year ago

/release-snapshot

github-actions[bot] commented 1 year ago

✅ Successfully published package/s with tag pr51-run81-1!