Core package for GraphQL Code Generator (v0.18.2), a tool that generates TypeScript/Flow types, React hooks, and other code from GraphQL schemas and operations. Stable release; moderate release cadence. Differentiator: plugin-based architecture supporting multiple frameworks (Apollo, URQL, etc.) and languages, with customizable outputs for resolvers, client-side operations, and introspection. Compared to alternatives (e.g., Apollo CLI), it offers broader plugin ecosystem and plugin-specific granularity.
npm install graphql-codegen-coreNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Generates TypeScript types from a GraphQL schema using the typescript plugin.
Use `generate({ schema, documents, filename, plugins, pluginMap })` instead of `generate(schema, documents, plugins)`.Use ES module import syntax: `import { generate } from 'graphql-codegen-core'`.Always pass a `pluginMap` object with resolved plugin modules (e.g., `{typescript: await import('@graphql-codegen/typescript')}`).Always include `filename` in the config object; it is now mandatory.
Install the plugin: `npm install -D @graphql-codegen/typescript`
Ensure schema is built with `buildSchema` or from an introspection result. Example: `buildSchema(fs.readFileSync('schema.graphql', 'utf8'))`Provide a valid string to `filename` in the generate config object.