-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate.ts
30 lines (23 loc) · 848 Bytes
/
generate.ts
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
import * as path from 'path';
import { ZenGenerator } from './tools/zen-generator';
import { readFileSync } from 'fs';
async function main() {
const subgraphsConfig = JSON.parse(readFileSync('./subgraphs.json').toString());
for (let subgraph in subgraphsConfig.subgraphs) {
const subgraphAPIPath = subgraphsConfig.subgraphs[subgraph];
const generator = new ZenGenerator({
palConfig: require(`./${subgraphAPIPath}/pal.js`),
apiOutPath: path.join(__dirname, `${subgraphAPIPath}/src/app/graphql`),
caslOutFile: path.join(__dirname, `${subgraphAPIPath}/src/app/auth/casl/generated.ts`),
frontend: {
outPath: path.join(__dirname, 'libs/graphql/src/lib'),
},
subgraphName: subgraph
});
await generator.run();
}
}
main().catch(e => {
console.error(e);
process.exit(1);
});