Generate output for each found .graphql source file? #4661
-
Is there an existing e.g. yml config way of e.g. generating a sibling Right now I'm doing this programmatically like the following which is totally fine with me, but I figure others have encountered this if they're generating hooks import { sync as glob } from 'glob'
import { generate } from '@graphql-codegen/cli'
const schema = '**/*.graphql'
const generates = Object.fromEntries(glob(match).map((filename) => [
filename.replace(/graphql$/, 'ts'),
{
documents: filename,
plugins: [{
'typescript-react-apollo': { /* ... */ },
}],
},
]))
// in my case I add urls to the `schema` option,
generate({ schema, generates }) If not, is adding an e.g. find . -name *.graphql \
-execdir sh -c 'echo ${0%.graphql}.ts' {} \; I may be missing how a wildcard 1:1 mapping option is already available or be off-base on one might theoretically be declared... cheers folks! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can use this instead; |
Beta Was this translation helpful? Give feedback.
You can use this instead;
https://graphql-code-generator.com/docs/presets/near-operation-file