Skip to content

About

Various GraphQL codegen plugins

Resources

Stars

1 star

Watchers

3 watching

Forks

Repository files navigation

GraphQL Codegen Plugins

Plugins for GraphQL Code Generator, maintained by Lab Digital.

Packages

Package Version Description
@labdigital/graphql-codegen-bruno npm Generates a Bruno request (.bru file) for every GraphQL operation in your codebase.
@labdigital/graphql-codegen-k6 npm Generates a typed SDK for your GraphQL operations that you can use in k6 load tests.
@labdigital/graphql-codegen-typedefs npm Generates a TypeScript module that exports your GraphQL schema as a typeDefs document.

Requirements

  • Node.js 22 or newer
  • graphql ^16.0.0 || ^17.0.0
  • @graphql-codegen/cli 7.x

All packages are published as ES modules only.

Usage

Install the CLI and the plugin you need, then reference the plugin by its package name in your codegen.ts:

pnpm add -D @graphql-codegen/cli graphql @labdigital/graphql-codegen-typedefs
import type { CodegenConfig } from "@graphql-codegen/cli";

const config: CodegenConfig = {
	schema: "schema.graphql",
	generates: {
		"src/generated/typedefs.ts": {
			plugins: ["@labdigital/graphql-codegen-typedefs"],
		},
	},
};

export default config;
pnpm graphql-codegen --config codegen.ts

See the README of each package for its configuration options and example output.

Development

This is a pnpm workspace (pnpm 12, see packageManager in package.json) using Turborepo for builds, tsdown for bundling, Vitest for tests and Biome for formatting and linting.

pnpm install     # install dependencies
pnpm build       # build all packages (packages/*/dist)
pnpm test        # run the tests
pnpm check       # biome ci + typecheck, as run in CI
pnpm format      # apply biome formatting and safe fixes

Releasing

Releases are managed with Changesets.

  1. Add a changeset to every pull request that changes a published package:

    pnpm changeset
  2. When the pull request is merged into main, the release workflow opens (or updates) a "Release new version" pull request that bumps the versions and updates the changelogs.

  3. Merging that pull request publishes the new versions to npm (with provenance, via npm trusted publishing).

License

MIT © Lab Digital

About

Various GraphQL codegen plugins

Resources

Stars

1 star

Watchers

3 watching

Forks

Releases

Used by

Contributors

Languages