-
Notifications
You must be signed in to change notification settings - Fork 0
/
.graphqlrc.js
29 lines (24 loc) · 881 Bytes
/
.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
'use strict';
const {sync: glob} = require('glob');
const examples = glob('*/', {cwd: 'examples'}).map((pathName) =>
pathName.replace(/\/$/, '')
);
/** @type {Record<string, import("graphql-config").IGraphQLProject>} */
const init = {};
/** @type {import("graphql-config").IGraphQLConfig } */
const config = {
projects: examples.reduce((acc, example) => {
acc[example] = {
schema: [
`examples/${example}/schema/**/*.graphqls`,
// This line loads types necessary for the collective schema to be valid.
'examples/common.graphqls',
// I haven't come up with a better way to get the core schema other than
// specifying it directly out of node_modules
'node_modules/@code-like-a-carpenter/foundation-intermediate-representation/schema.graphqls',
],
};
return acc;
}, init),
};
module.exports = config;