nitrogql logonitrogql

@nitrogql/cli reference

This page describes usage of @nitrogql/cli as a library. For usage as a CLI, see CLI Usage.

@nitrogql/cli exports types that help writing config files.

NitrogqlConfig

Type of the entire object exported by graphql.config.ts.

Example:

import type { NitrogqlConfig } from "@nitrogql/cli";

const config: NitrogqlConfig = {
  schema: "src/schema/*.graphql",
  documents: "src/app/**/*.graphql",
  extensions: {
    nitrogql: {
      plugins: ["nitrogql:model-plugin"],
      // ...
    }
  }
};

export default config;

NitrogqlExtension

Type of extensions.nitrogql in the config file. Useful when you want to mix nitrogql with other tools.

Example:

import type { NitrogqlExtension } from "@nitrogql/cli";

const nitrogql: NitrogqlExtension = {
  plugins: ["nitrogql:model-plugin"],
  // ...
};

const config = {
  schema: "src/schema/*.graphql",
  documents: "src/app/**/*.graphql",
  extensions: {
    nitrogql,
    // ...
  }
};

export default config;