Skip to content

Commit 6cc6b28

Browse files
committed
refactor: fix installation graphql script (#3)
#3
1 parent 147089c commit 6cc6b28

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

scripts/fetch-schema.js

+7-13
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,13 @@ const thegraphConfig = require('../graphql.thegraph.config')
99

1010
const exec = promisify(child_process.exec)
1111

12-
function fetchSchema(url, outputFile) {
13-
exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`)
14-
.then(({ stderr, stdout }) => {
15-
if (stderr) {
16-
throw new Error(stderr)
17-
} else {
18-
fs.writeFile(outputFile, stdout)
19-
}
20-
})
21-
.catch((err) => {
22-
console.error(err)
23-
console.error(`Failed to fetch schema from ${url}`)
24-
})
12+
async function fetchSchema(url, outputFile) {
13+
try {
14+
const { stdout } = await exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`);
15+
await fs.writeFile(outputFile, stdout);
16+
} catch(err){
17+
console.error(`Failed to fetch schema from ${url}`)
18+
}
2519
}
2620

2721
fetchSchema(process.env.THE_GRAPH_SCHEMA_ENDPOINT, thegraphConfig.schema)

0 commit comments

Comments
 (0)