2022-12-21 03:08:20 +04:00
|
|
|
/* eslint-env node */
|
|
|
|
|
2022-09-26 18:01:50 -04:00
|
|
|
require('dotenv').config({ path: '.env.production' })
|
2022-12-21 03:08:20 +04:00
|
|
|
|
2022-08-19 15:31:10 -04:00
|
|
|
const { exec } = require('child_process')
|
2022-12-20 13:42:52 -08:00
|
|
|
const dataConfig = require('./graphql.config')
|
|
|
|
const thegraphConfig = require('./graphql_thegraph.config')
|
2022-08-19 15:31:10 -04:00
|
|
|
|
2022-11-17 13:33:08 -05:00
|
|
|
function fetchSchema(url, outputFile) {
|
|
|
|
exec(
|
|
|
|
`get-graphql-schema --h Origin=https://app.uniswap.org ${url} | tee ${outputFile}.temp`,
|
|
|
|
(error, stdout, stderr) => {
|
|
|
|
if (error || stderr) {
|
|
|
|
console.log(`Failed to fetch schema from ${url}`)
|
|
|
|
} else if (stdout) {
|
|
|
|
exec(`mv ${outputFile}.temp ${outputFile}`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
)
|
|
|
|
}
|
2022-08-19 15:31:10 -04:00
|
|
|
|
2022-11-17 13:33:08 -05:00
|
|
|
fetchSchema(process.env.THE_GRAPH_SCHEMA_ENDPOINT, thegraphConfig.schema)
|
|
|
|
fetchSchema(process.env.REACT_APP_AWS_API_ENDPOINT, dataConfig.schema)
|