MCPcopy Create free account
hub / github.com/Shopify/function-examples / getConfig

Function getConfig

sample-apps/discounts/.graphqlrc.js:4–34  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2const apiVersion = require("@shopify/shopify-app-remix").LATEST_API_VERSION;
3
4function getConfig() {
5 const config = {
6 projects: {
7 shopifyAdminApi: {
8 schema: `https://shopify.dev/admin-graphql-direct-proxy/${apiVersion}`,
9 documents: ['./app/**/*.{graphql,js,ts,jsx,tsx}']
10 }
11 }
12 }
13
14 let extensions = []
15 try {
16 extensions = fs.readdirSync('./extensions');
17 } catch {
18 // ignore if no extensions
19 }
20
21 for (const entry of extensions) {
22 const extensionPath = `./extensions/${entry}`;
23 const schema = `${extensionPath}/schema.graphql`;
24 if(!fs.existsSync(schema)) {
25 continue;
26 }
27 config.projects[entry] = {
28 schema,
29 documents: [`${extensionPath}/input.graphql`]
30 }
31 }
32
33 return config;
34}
35
36module.exports = getConfig();

Callers 1

.graphqlrc.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected