-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy path.graphqlrc.cjs
43 lines (37 loc) · 1.38 KB
/
.graphqlrc.cjs
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
/**
* Configures the GraphQL language server for all the function schemas in this repo.
*/
const fs = require('node:fs');
function getProjects(path) {
const projects = {}
const extensions = fs.readdirSync(`./${path}`);
for (const entry of extensions) {
const extensionPath = `./${path}/${entry}`;
const schema = `${extensionPath}/schema.graphql`;
if(!fs.existsSync(schema)) {
continue;
}
const projectName = extensionPath.substring(2).replaceAll('/', '-');
projects[projectName] = {
schema,
documents: `${extensionPath}/input.graphql`
}
}
return projects;
}
const projects = {
...getProjects("sample-apps/discounts/extensions"),
...getProjects("sample-apps/payment-customizations/extensions"),
...getProjects("sample-apps/delivery-customizations/extensions"),
...getProjects("checkout/rust/delivery-customization"),
...getProjects("checkout/rust/payment-customization"),
...getProjects("checkout/javascript/delivery-customization"),
...getProjects("checkout/javascript/payment-customization"),
...getProjects("checkout/javascript/cart-checkout-validation"),
...getProjects("discounts/rust/order-discounts"),
...getProjects("discounts/rust/product-discounts"),
...getProjects("discounts/rust/shipping-discounts"),
}
module.exports = {
projects
};