Skip to content

Commit

Permalink
refactor: fix installation graphql script (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
aahna-ashina committed Dec 26, 2023
1 parent 147089c commit 6cc6b28
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions scripts/fetch-schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@ const thegraphConfig = require('../graphql.thegraph.config')

const exec = promisify(child_process.exec)

function fetchSchema(url, outputFile) {
exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`)
.then(({ stderr, stdout }) => {
if (stderr) {
throw new Error(stderr)
} else {
fs.writeFile(outputFile, stdout)
}
})
.catch((err) => {
console.error(err)
console.error(`Failed to fetch schema from ${url}`)
})
async function fetchSchema(url, outputFile) {
try {
const { stdout } = await exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`);

Check failure on line 14 in scripts/fetch-schema.js

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
await fs.writeFile(outputFile, stdout);

Check failure on line 15 in scripts/fetch-schema.js

View workflow job for this annotation

GitHub Actions / lint

Delete `;`
} catch(err){

Check failure on line 16 in scripts/fetch-schema.js

View workflow job for this annotation

GitHub Actions / lint

Replace `(err)` with `·(err)·`
console.error(`Failed to fetch schema from ${url}`)
}
}

fetchSchema(process.env.THE_GRAPH_SCHEMA_ENDPOINT, thegraphConfig.schema)
Expand Down

0 comments on commit 6cc6b28

Please sign in to comment.