Created
December 15, 2017 17:07
-
-
Save flesch/35b19abf103aa08c16fad222e68e90c4 to your computer and use it in GitHub Desktop.
This file contains 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 { buildSchema } = require('graphql'); | |
const glob = require('glob-promise'); | |
const { readFile } = require('fs-extra'); | |
const { join } = require('path'); | |
async function stitchSchema(dir) { | |
const files = await glob(dir); | |
const contents = await Promise.all(files.map(file => readFile(file, 'utf8'))); | |
return buildSchema(contents.join('\n\n')); | |
} | |
module.exports = { stitchSchema }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment