12 lines
498 B
JavaScript
12 lines
498 B
JavaScript
import { getIntrospectedSchema, minifyIntrospectionQuery } from "@urql/introspection";
|
|
import { readFileSync, writeFileSync } from "fs";
|
|
|
|
// Read the existing introspection schema
|
|
const schema = readFileSync("./src/gql/schema.graphql", "utf-8");
|
|
// const schema = JSON.parse(schemaJson);
|
|
|
|
const minifiedSchema = minifyIntrospectionQuery(getIntrospectedSchema(schema));
|
|
|
|
// Write the minified schema to a new file
|
|
writeFileSync("./src/gql/dist/minifiedSchema.json", JSON.stringify(minifiedSchema));
|