Created
September 5, 2022 02:06
-
-
Save JulienHe/9381c916b79f4b5cd0c73b19e83d228b to your computer and use it in GitHub Desktop.
Typedefs plugin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { printSchema } = require("graphql"); | |
module.exports = { | |
plugin: (schema, documents, config) => { | |
const theSchema = printSchema(schema).replaceAll("`", ""); | |
return [ | |
"const typeDefs = /* GraphQL */ `", | |
theSchema, | |
"`;", | |
"export default typeDefs;", | |
].join("\n"); | |
}, | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment