MCPcopy Index your code
hub / github.com/Shopify/function-examples / getProjects

Function getProjects

.graphqlrc.cjs:6–25  ·  view source on GitHub ↗
(path)

Source from the content-addressed store, hash-verified

4const fs = require('node:fs');
5
6function getProjects(path) {
7 const projects = {}
8
9 const extensions = fs.readdirSync(`./${path}`);
10 for (const entry of extensions) {
11 const extensionPath = `./${path}/${entry}`;
12 const schema = `${extensionPath}/schema.graphql`;
13 if(!fs.existsSync(schema)) {
14 continue;
15 }
16
17 const projectName = extensionPath.substring(2).replaceAll('/', '-');
18 projects[projectName] = {
19 schema,
20 documents: `${extensionPath}/input.graphql`
21 }
22 }
23
24 return projects;
25}
26
27const projects = {
28 ...getProjects("sample-apps/discounts/extensions"),

Callers 1

.graphqlrc.cjsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected