-
Notifications
You must be signed in to change notification settings - Fork 0
/
.graphqlrc.js
47 lines (42 loc) · 1.44 KB
/
.graphqlrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
const fs = require("node:fs");
const apiVersion = require("@shopify/shopify-app-remix").LATEST_API_VERSION;
function getConfig() {
const config = {
projects: {
// Storefront API
// Here is the config to tell graphql.vscode-graphql to use the storefront GraphQL Schema
// Steps:
// 1. Uncomment lines 14-17 (the shopifyStorefrontApi property)
// 2. Update the documents array to point to files that use the storefront API
// Do not mix and match storefront and admin API documents in the same file.
// If a route needs both APIs, create a separate file for each API.
// shopifyStorefrontApi: {
// schema: `https://shopify.dev/storefront-graphql-direct-proxy/${apiVersion}`,
// documents: ["./app/routes/app.storefront.jsx"],
// },
shopifyAdminApi: {
schema: `https://shopify.dev/admin-graphql-direct-proxy/${apiVersion}`,
documents: ["./app/**/*.{graphql,js,ts,jsx,tsx}"],
},
},
};
let extensions = [];
try {
extensions = fs.readdirSync("./extensions");
} catch {
// ignore if no extensions
}
for (const entry of extensions) {
const extensionPath = `./extensions/${entry}`;
const schema = `${extensionPath}/schema.graphql`;
if (!fs.existsSync(schema)) {
continue;
}
config.projects[entry] = {
schema,
documents: [`${extensionPath}/**/*.graphql`],
};
}
return config;
}
module.exports = getConfig();