Skip to content

Instantly share code, notes, and snippets.

@renanmav
Created May 20, 2020 22:02
Show Gist options
  • Save renanmav/6b47a5d7effba4dda51a551cfdd402e3 to your computer and use it in GitHub Desktop.
Save renanmav/6b47a5d7effba4dda51a551cfdd402e3 to your computer and use it in GitHub Desktop.
import fs from 'fs';
import path from 'path';
import { promisify } from 'util';
import { printSchema } from 'graphql/utilities';
import schema from '@sejamelhoramigo/graphql/src/schema';
const writeFileAsync = promisify(fs.writeFile);
(async () => {
const configs = [
{
schema,
path: './',
},
];
for await (const config of configs) {
await writeFileAsync(path.join(process.cwd(), `${config.path}/schema.graphql`), printSchema(config.schema));
}
process.exit(0);
})();
{
__schema {
directives {
name
description
}
subscriptionType {
name
description
}
types {
name
description
}
queryType {
name
description
}
mutationType {
name
description
}
queryType {
name
description
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment