Skip to content

Instantly share code, notes, and snippets.

@ts-ign0re
Created May 18, 2022 08:15
Show Gist options
  • Save ts-ign0re/6008b928aa1e70289ab84ac3aea9f654 to your computer and use it in GitHub Desktop.
Save ts-ign0re/6008b928aa1e70289ab84ac3aea9f654 to your computer and use it in GitHub Desktop.
Add schema fileNamePrefix for multiple grapnel schema support
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