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

Function getConfig

sample-apps/payment-customizations/.graphqlrc.js:5–37  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3import { shopifyApiProject, ApiType } from "@shopify/api-codegen-preset";
4
5function getConfig() {
6 const config = {
7 projects: {
8 default: shopifyApiProject({
9 apiType: ApiType.Admin,
10 apiVersion: LATEST_API_VERSION,
11 documents: ["./app/**/*.{js,jsx}", "./app/.server/**/*.{js,jsx}"],
12 outputDir: "./app/types",
13 }),
14 },
15 };
16
17 let extensions = [];
18 try {
19 extensions = fs.readdirSync("./extensions");
20 } catch {
21 // ignore if no extensions
22 }
23
24 for (const entry of extensions) {
25 const extensionPath = `./extensions/${entry}`;
26 const schema = `${extensionPath}/schema.graphql`;
27 if (!fs.existsSync(schema)) {
28 continue;
29 }
30 config.projects[entry] = {
31 schema,
32 documents: [`${extensionPath}/**/*.graphql`],
33 };
34 }
35
36 return config;
37}
38
39const config = getConfig();
40

Callers 1

.graphqlrc.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected