Gentime Settings
You are able to control certain aspects of the Nexus Prisma code generation.
Usage
Create a configuration file named any of:
nexusPrisma.ts / nexus-prisma.ts / nexus_prisma.ts
In one of the following directories:
Project Root – The directory containing your project's package.json. Example:
├── nexus-prisma.ts └── package.json
Prisma Directory – The directory containing your Prisma schema. Example:
├── prisma/nexus-prisma.ts └── package.json
If you have not already, install
ts-node
whichnexus-prisma
will use to read your configuration module.Import the settings singleton and make your desired changes. Example:
import { settings } from 'nexus-prisma/generator'settings({projectIdIntToGraphQL: 'ID',})
Reference
Please refer to the thorough JSDoc for reference documentation. Typically consumed in your IDE or Paka.
Notes
Prisma Schema File Generator Config
Nexus Prisma supports custom configuration of the output directory within the generator block within your Prisma Schema file like so:
// prisma/schema.prisma
generator nexusPrisma {
provider = "nexus-prisma"
output = "../generated/nexus-prisma"
}
The above is equivalent to the following:
// prisma/nexus-prisma.ts
import { settings } from 'nexus-prisma/generator'
settings({ output: '../generated/nexus-prisma',})
It is considered idiomatic to use the Nexus Prisma configuration file instead of inline generator block configuration. Inline generator block configuration lacks autocomplete and inline JSDoc. The only reason output
is supported is to be symmetrical with Prisma Client and thus ease onboarding.