Configuration File Name
A configuration file is to be placed in the root of your project. The nitrogql CLI will automatically search for a configuration file in the current directory.
Default config file name
By default, configuration file is searched in the following order:
graphql.config.json
graphql.config.yaml
graphql.config.yml
graphql.config.js
graphql.config.mjs
graphql.config.cjs
graphql.config.ts
graphql.config.mts
graphql.config.cts
.graphqlrc
.graphqlrc.json
.graphqlrc.yaml
.graphqlrc.yml
.graphqlrc.js
.graphqlrc.mjs
.graphqlrc.cjs
.graphqlrc.ts
.graphqlrc.mts
.graphqlrc.cts
Using JavaScript/TypeScript configuration files
nitrogql supports configuration files written in JavaScript or TypeScript (both CommonJS and ES Module syntax are supported). When using a JavaScript configuration file, an ES Module configuration file should default-export the configuration object. A CommonJS configuration file should assign the configuration object to module.exports
.
import type { NitrogqlConfig } from "@nitrogql/cli";
const config: NitrogqlConfig = {
schema: "./schema/*.graphql",
documents: ["./app/**/*.graphql", "./common/**/*.graphql"],
// ...
};
export default config;