Are there some sort of options you can configure for Apollo Client Codegen beyond the basic limited options here? Specifically I am trying to:
- Remove top level
__generated__
folder - Format after generation
- Change filename casing
The command I am using is apollo client:codegen --target typescript --globalTypesFile='./src/__generated__/global-types.ts'
.
I wanted to move the global types into the src
directory, so I used the -globalTypesFile
option, but codegen still generates an empty folder at the project root (as well as generating the global types in the src
directory).
I'm using Prettier, and whenever I run codegen I am left with a bunch of file diffs because of the way the generated code is formatted. I then have to run Prettier again manually to reformat the generated files. I've used @graphql/codegen
before which allows you to set a afterAllFileWrite
hook, so you can tell it to run Prettier after generating files but I can’t see how to do this with apollo codegen.
I use kebab-case filenames throughout my codebase, but Apollo Client Codegen creates the generated files using PascalCase. I'd like to have this consistent with the rest of my codebase but I can't see any option to change this.