Created
May 18, 2022 08:15
-
-
Save ts-ign0re/6008b928aa1e70289ab84ac3aea9f654 to your computer and use it in GitHub Desktop.
Add schema fileNamePrefix for multiple grapnel schema support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/graphql-fetch-schema/lib/index.js b/node_modules/graphql-fetch-schema/lib/index.js | |
index 0411d13..bf385e4 100644 | |
--- a/node_modules/graphql-fetch-schema/lib/index.js | |
+++ b/node_modules/graphql-fetch-schema/lib/index.js | |
@@ -59,14 +59,14 @@ function () { | |
if (options.graphql) { | |
files.push({ | |
- filePath: _path.default.resolve(pathPrefix, 'schema.graphql'), | |
+ filePath: _path.default.resolve(pathPrefix, options.fileNamePrefix ? options.fileNamePrefix + '.schema.graphql' : 'schema.graphql'), | |
contents: (0, _graphql.printSchema)((0, _graphql.buildClientSchema)(schema.data)) | |
}); | |
} | |
if (options.json) { | |
files.push({ | |
- filePath: _path.default.resolve(pathPrefix, 'schema.json'), | |
+ filePath: _path.default.resolve(pathPrefix, options.fileNamePrefix ? options.fileNamePrefix + '.schema.json' : 'schema.json'), | |
contents: JSON.stringify(schema, null, 2) | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment