A NextJS starter for WordPress installations with WPGraphQL, including TypeScript and dynamic type generating with graphql-codegen
- Works out of the box with any WordPress installation including WPGraphQL
- TypeScript and dynamic type generating with graphql-codegen
- Prettier, ESLint, Husky and Lint Staged
- Clone this repository to your machine
- Run
yarn install - Rename
.env.local.exampletoenv.localfile - Add your
WORDPRESS_API_URLurl to your.env.localfile - Run
yarn generate:codegento generate types* - Run
yarn devto start a local server and start developing
- *Running graphql-codegen on the WPGraphQL schema generates two invalid enum types,
2048X2048and1536X1536. These are invalid because they start numeric. There is currently an issue opened about this right here: dotansimha/graphql-code-generator#4834.
By running yarn generate:codegen you can generate types right from your WPGraphQL schema and the operations defined in .src/graphql/**/*. You can see and update the confing in the codegen.yml file in the root of your project. The endpoint is loaded from the .env.local file.