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.jsongraphql.config.yamlgraphql.config.ymlgraphql.config.jsgraphql.config.mjsgraphql.config.cjsgraphql.config.tsgraphql.config.mtsgraphql.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;