I'd like the ability to validate my codegen'ed types from the CLI for two reasons:
-
CI!
-
When I forget to update types on the fly, I'd like to be able to use something like git bisect to find exactly which commit I forgot to update the types in:
git bisect run npx apollo client:codegen \
--config=[config-filename] \
--passthroughCustomScalars \
--outputFlat \
--validate
I can think of two ways to handle this:
-
[Preferred] Add an option that generates types, compares to all files that will be written instead of actually writing, and then exit with a non-zero exit code if any files are incorrect.
-
[Stopgap?] Allow output to stdout instead of always writing to a file
For example, allow a - param to signify that we want to write to stdout instead of a real file; possibly only allow such an option when --outputFlat is also specified.
npx apollo client:codegen --config=[config-filename] \
--passthroughCustomScalars \
--outputFlat \
--target=typescript \
-
I'd like the ability to validate my codegen'ed types from the CLI for two reasons:
CI!
When I forget to update types on the fly, I'd like to be able to use something like
git bisectto find exactly which commit I forgot to update the types in:I can think of two ways to handle this:
[Preferred] Add an option that generates types, compares to all files that will be written instead of actually writing, and then exit with a non-zero exit code if any files are incorrect.
[Stopgap?] Allow output to stdout instead of always writing to a file
For example, allow a
-param to signify that we want to write tostdoutinstead of a real file; possibly only allow such an option when--outputFlatis also specified.