UNPKG

1.29 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3const tslib_1 = require("tslib");
4const graphql_1 = require("graphql");
5const filesystem_1 = require("../helpers/filesystem");
6exports.defaultPrintSchemaOptions = { commentDescriptions: false };
7const generatedSchemaWarning = /* graphql */ `\
8# -----------------------------------------------
9# !!! THIS FILE WAS GENERATED BY TYPE-GRAPHQL !!!
10# !!! DO NOT MODIFY THIS FILE BY YOURSELF !!!
11# -----------------------------------------------
12
13`;
14function emitSchemaDefinitionFileSync(schemaFilePath, schema, options = exports.defaultPrintSchemaOptions) {
15 const schemaFileContent = generatedSchemaWarning + graphql_1.printSchema(schema, options);
16 filesystem_1.outputFileSync(schemaFilePath, schemaFileContent);
17}
18exports.emitSchemaDefinitionFileSync = emitSchemaDefinitionFileSync;
19function emitSchemaDefinitionFile(schemaFilePath, schema, options = exports.defaultPrintSchemaOptions) {
20 return tslib_1.__awaiter(this, void 0, void 0, function* () {
21 const schemaFileContent = generatedSchemaWarning + graphql_1.printSchema(schema, options);
22 yield filesystem_1.outputFile(schemaFilePath, schemaFileContent);
23 });
24}
25exports.emitSchemaDefinitionFile = emitSchemaDefinitionFile;