Use schema-ast plugin to generate the graphql schema (#2538)
This commit is contained in:
parent
48fb75423a
commit
31fcd45fac
4 changed files with 5 additions and 16 deletions
|
@ -22,6 +22,7 @@ All notable, unreleased changes to this project will be documented in this file.
|
||||||
- Extract permissions for subscription query - #3155 by @zaiste
|
- Extract permissions for subscription query - #3155 by @zaiste
|
||||||
- Add custom request headers to webhook form - #3107 by @2can
|
- Add custom request headers to webhook form - #3107 by @2can
|
||||||
- Allow subscription query for sync events - #3099 by @2can
|
- Allow subscription query for sync events - #3099 by @2can
|
||||||
|
- Simplify codegen configuration to generate the graphql schema - #2538 by @abumalick
|
||||||
|
|
||||||
## 3.4
|
## 3.4
|
||||||
|
|
||||||
|
|
|
@ -3,3 +3,6 @@ generates:
|
||||||
./introspection.json:
|
./introspection.json:
|
||||||
plugins:
|
plugins:
|
||||||
- introspection
|
- introspection
|
||||||
|
./schema.graphql:
|
||||||
|
plugins:
|
||||||
|
- schema-ast
|
||||||
|
|
|
@ -284,7 +284,7 @@
|
||||||
"check-types": "tsc --noEmit",
|
"check-types": "tsc --noEmit",
|
||||||
"extract-json-messages": "formatjs extract 'src/**/*.{ts,tsx}' --out-file locale/defaultMessages.json --format scripts/formatter.js",
|
"extract-json-messages": "formatjs extract 'src/**/*.{ts,tsx}' --out-file locale/defaultMessages.json --format scripts/formatter.js",
|
||||||
"extract-messages": "npm run extract-json-messages",
|
"extract-messages": "npm run extract-json-messages",
|
||||||
"fetch-schema": "graphql-codegen --config ./fetch-schema.yml && node scripts/build-schema.js",
|
"fetch-schema": "graphql-codegen --config ./fetch-schema.yml",
|
||||||
"heroku-postbuild": "npm run build",
|
"heroku-postbuild": "npm run build",
|
||||||
"serve:lhci": "cross-env NODE_ENV=production npm run server",
|
"serve:lhci": "cross-env NODE_ENV=production npm run server",
|
||||||
"prestart": "npm run build-types",
|
"prestart": "npm run build-types",
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
/* 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