Add build-schema tool (#1947)
* Add build-schema tool * Include build-schema in fetch schema
This commit is contained in:
parent
8bc2931679
commit
560ed2cd6e
3 changed files with 15359 additions and 1 deletions
|
@ -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
15343
schema.graphql
Normal file
File diff suppressed because it is too large
Load diff
15
scripts/build-schema.js
Normal file
15
scripts/build-schema.js
Normal 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");
|
||||
});
|
Loading…
Reference in a new issue