{"size": 758, "ext": "js", "max_stars_repo_path": ".scripts/graphql/update-schema.js", "max_stars_repo_name": "slopen/react-relay-storybook-test", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": ".scripts/graphql/update-schema.js", "max_issues_repo_name": "slopen/react-relay-storybook-test", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": ".scripts/graphql/update-schema.js", "max_forks_repo_name": "slopen/react-relay-storybook-test", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 28.0740740741, "max_line_length": 64, "alphanum_fraction": 0.6042216359}
import fs from 'fs';
import path from 'path';
import {graphql, buildSchema}  from 'graphql';
import {introspectionQuery} from 'graphql/utilities';

// TODO: Prettify
const sourcePath = __dirname + '/../../data/schema.graphql';
const outputPath = __dirname + '/../../data/schema.json';

(async () => {
    const source = fs.readFileSync (sourcePath);
    const schema = buildSchema (source.toString ());
    const result = await (graphql (schema, introspectionQuery));

    if (result.errors) {
        console.error (
            'ERROR introspecting schema: ',
            JSON.stringify (result.errors, null, 2)
        );
    } else {
        fs.writeFileSync (
            outputPath,
            JSON.stringify (result, null, 2)
        );
    }
}) ();
