Add build-schema tool (#1947)

* Add build-schema tool

* Include build-schema in fetch schema
This commit is contained in:
Michał Droń 2022-03-29 10:39:33 +02:00 committed by GitHub
parent 8bc2931679
commit 560ed2cd6e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15359 additions and 1 deletions

View file

@ -260,7 +260,7 @@
"check-types": "tsc --noEmit",
"extract-json-messages": "rimraf build/locale && cross-env NODE_ENV=extract babel src 'src/**/*.{ts,tsx}' -o build/dashboard.bundle.js",
"extract-messages": "npm run extract-json-messages && npm run transpile-messages",
"fetch-schema": "graphql-codegen --config ./fetch-schema.yml",
"fetch-schema": "graphql-codegen --config ./fetch-schema.yml && node scripts/build-schema.js",
"heroku-postbuild": "npm run build",
"serve:lhci": "NODE_ENV=production npm run server",
"start": "npm run build-types && webpack-dev-server -d",

15343
schema.graphql Normal file

File diff suppressed because it is too large Load diff

15
scripts/build-schema.js Normal file
View file

@ -0,0 +1,15 @@
/* eslint-disable no-console */
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require("fs");
const graphql = require("graphql");
const schema = require("../introspection.json");
const clientSchema = graphql.buildClientSchema(schema);
const schemaString = graphql.printSchema(clientSchema);
fs.writeFile("schema.graphql", schemaString, err => {
if (err) {
throw err;
}
console.log("🚀 Schema from instrospection built successfully\n");
});