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

Function getConfig

sample-apps/delivery-customizations/.graphqlrc.ts:6–38  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

Callers 1

.graphqlrc.tsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected