graphql-code-generator icon indicating copy to clipboard operation
graphql-code-generator copied to clipboard

Support adding file contents via 'add' plugin

Open eddiew opened this issue 1 year ago • 0 comments

Is your feature request related to a problem? Please describe.

I use graphql-codegen to write the same type definitions for my db types into a few different dockerized services. Some of these types are user-defined, which i currently specify with the 'add' plugin. However I have to duplicate these definitions for each output file, which is getting to be a little bit annoying to maintain. Plus I don't get syntax highlighting since this "code" is technically a string literal in my config file.

Describe the solution you'd like

A way to specify a file path in the 'add' plugin and have the plugin copy file contents

Describe alternatives you've considered

I tried putting "import * as X from './types'" but I had trouble getting this to work with my docker setup because I need to make the ./types file available to each container.

Currently I duplicate the types that I want to add for each output file

eddiew avatar Jan 20 '24 00:01 eddiew