2022-12-21 02:08:20 +03:00
|
|
|
/* eslint-env node */
|
|
|
|
|
2022-09-27 01:01:50 +03:00
|
|
|
require('dotenv').config({ path: '.env.production' })
|
2022-12-21 02:08:20 +03:00
|
|
|
|
2022-08-19 22:31:10 +03:00
|
|
|
const { exec } = require('child_process')
|
2022-12-21 00:42:52 +03:00
|
|
|
const dataConfig = require('./graphql.config')
|
|
|
|
const thegraphConfig = require('./graphql_thegraph.config')
|
2022-08-19 22:31:10 +03:00
|
|
|
|
2022-11-17 21:33:08 +03: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 22:31:10 +03:00
|
|
|
|
2022-11-17 21:33:08 +03:00
|
|
|
fetchSchema(process.env.THE_GRAPH_SCHEMA_ENDPOINT, thegraphConfig.schema)
|
|
|
|
fetchSchema(process.env.REACT_APP_AWS_API_ENDPOINT, dataConfig.schema)
|