how are you generating the graphql schema?
jgcmarins opened this issue · 1 comments
jgcmarins commented
how are you generating the graphql schema?
daniloab commented
On this repo, I ain't generating yet. But you can follow the script below:
import { promisify } from 'util';
import fs from 'fs';
import path from 'path';
import { printSchema } from 'graphql/utilities';
import { schema } from '../src/schema';
const writeFileAsync = promisify(fs.writeFile);
const cwd = process.cwd();
(async () => {
const configs = [
{
schema,
path: path.join(cwd, `./packages/server/schema/schema.graphql`),
},
];
await Promise.all([
...configs.map(async (config) => {
await writeFileAsync(config.path, printSchema(config.schema));
}),
]);
process.exit(0);
})();