-
Notifications
You must be signed in to change notification settings - Fork 779
/
Copy pathbuild.ts
35 lines (32 loc) · 867 Bytes
/
build.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
31
32
33
34
35
import yargs from 'yargs'
import { build, deploy } from './utils/deploy-utils'
import { validateNetwork, validateSubgraphType } from './utils/prepareNetwork'
async function main() {
const argv = await yargs(process.argv.slice(2))
.option('network', {
alias: 'n',
description: 'Network to build for',
type: 'string',
demandOption: true,
})
.option('subgraph-type', {
alias: 's',
description: 'Type of the subgraph',
type: 'string',
demandOption: true,
})
.option('deploy', {
alias: 'd',
description: 'Deploy the subgraph',
type: 'boolean',
default: false,
})
.help().argv
validateNetwork(argv.network)
validateSubgraphType(argv.subgraphType)
await build(argv.network, argv.subgraphType)
if (argv.deploy) {
await deploy(argv.subgraphType)
}
}
main()