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' })
|
2023-03-22 18:14:07 +03:00
|
|
|
const child_process = require('child_process')
|
|
|
|
const fs = require('fs/promises')
|
|
|
|
const { promisify } = require('util')
|
2023-05-10 01:49:53 +03:00
|
|
|
const dataConfig = require('../graphql.data.config')
|
|
|
|
const thegraphConfig = require('../graphql.thegraph.config')
|
2022-08-19 22:31:10 +03:00
|
|
|
|
2023-03-22 18:14:07 +03:00
|
|
|
const exec = promisify(child_process.exec)
|
|
|
|
|
2022-11-17 21:33:08 +03:00
|
|
|
function fetchSchema(url, outputFile) {
|
2023-06-06 21:59:03 +03:00
|
|
|
exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`)
|
2023-03-22 18:14:07 +03:00
|
|
|
.then(({ stderr, stdout }) => {
|
|
|
|
if (stderr) {
|
|
|
|
throw new Error(stderr)
|
|
|
|
} else {
|
|
|
|
fs.writeFile(outputFile, stdout)
|
2022-11-17 21:33:08 +03:00
|
|
|
}
|
2023-03-22 18:14:07 +03:00
|
|
|
})
|
|
|
|
.catch((err) => {
|
|
|
|
console.error(err)
|
|
|
|
console.error(`Failed to fetch schema from ${url}`)
|
|
|
|
})
|
2022-11-17 21:33:08 +03:00
|
|
|
}
|
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)
|