1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | const tslib_1 = require("tslib");
|
4 | const graphql_1 = require("graphql");
|
5 | const filesystem_1 = require("../helpers/filesystem");
|
6 | exports.defaultPrintSchemaOptions = { commentDescriptions: false };
|
7 | const generatedSchemaWarning = `\
|
8 | # -----------------------------------------------
|
9 | # !!! THIS FILE WAS GENERATED BY TYPE-GRAPHQL !!!
|
10 | # !!! DO NOT MODIFY THIS FILE BY YOURSELF !!!
|
11 | # -----------------------------------------------
|
12 |
|
13 | `;
|
14 | function emitSchemaDefinitionFileSync(schemaFilePath, schema, options = exports.defaultPrintSchemaOptions) {
|
15 | const schemaFileContent = generatedSchemaWarning + graphql_1.printSchema(schema, options);
|
16 | filesystem_1.outputFileSync(schemaFilePath, schemaFileContent);
|
17 | }
|
18 | exports.emitSchemaDefinitionFileSync = emitSchemaDefinitionFileSync;
|
19 | function 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 | }
|
25 | exports.emitSchemaDefinitionFile = emitSchemaDefinitionFile;
|