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)
|
|
|
|
|
2023-12-19 16:56:52 +03:00
|
|
|
async function fetchSchema(url, outputFile) {
|
|
|
|
try {
|
|
|
|
const { stdout } = await exec(`yarn --silent get-graphql-schema --h Origin=https://app.uniswap.org ${url}`);
|
|
|
|
await fs.writeFile(outputFile, stdout);
|
|
|
|
} catch(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)
|