1
0
mirror of https://github.com/oceanprotocol/market.git synced 2024-12-02 05:57:29 +01:00

replaced introspection generation with graphql codegen

This commit is contained in:
Bogdan Fazakas 2021-07-06 01:09:51 +03:00
parent 8d50eb92c0
commit 04b89ddd35
7 changed files with 3349 additions and 19852 deletions

2
.gitignore vendored
View File

@ -14,3 +14,5 @@ public/storybook
repo-metadata.json repo-metadata.json
content/networks-metadata.json content/networks-metadata.json
src/@types/apollo src/@types/apollo
graphql.schema.json
src/@types/graph.types.ts

View File

@ -8,7 +8,7 @@ execSync(`node ./scripts/write-repo-metadata > repo-metadata.json`, {
}) })
// Generate GraphQl typings for urql // Generate GraphQl typings for urql
execSync(`npm run graphql:generateSchema`, { stdio: 'inherit' }) execSync(`npm run graphql:graphTypes`, { stdio: 'inherit' })
// Fetch EVM networks metadata // Fetch EVM networks metadata
execSync( execSync(

3586
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
"build": "gatsby build && cp _redirects public/_redirects", "build": "gatsby build && cp _redirects public/_redirects",
"serve": "serve -s public/", "serve": "serve -s public/",
"jest": "NODE_ENV=test jest -c tests/unit/jest.config.js", "jest": "NODE_ENV=test jest -c tests/unit/jest.config.js",
"test": "npm run graphql:generateSchema && npm run lint && npm run jest", "test": "npm run graphql:graphTypes && npm run lint && npm run jest",
"test:watch": "npm run lint && npm run jest -- --watch", "test:watch": "npm run lint && npm run jest -- --watch",
"lint": "npm run write:repoMetadata && eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx . && npm run type-check", "lint": "npm run write:repoMetadata && eslint --ignore-path .gitignore --ext .js --ext .ts --ext .tsx . && npm run type-check",
"format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json}' --write", "format": "prettier --ignore-path .gitignore './**/*.{css,yml,js,ts,tsx,json}' --write",
@ -19,8 +19,8 @@
"storybook:build": "build-storybook -c .storybook -o public/storybook", "storybook:build": "build-storybook -c .storybook -o public/storybook",
"write:repoMetadata": "node ./scripts/write-repo-metadata > repo-metadata.json", "write:repoMetadata": "node ./scripts/write-repo-metadata > repo-metadata.json",
"deploy:s3": "./scripts/deploy-s3.sh", "deploy:s3": "./scripts/deploy-s3.sh",
"graphql:generateSchema": "node ./scripts/generate-graphql-schema", "postinstall": "husky install",
"postinstall": "husky install" "graphql:graphTypes": "graphql-codegen --config codegen.yml"
}, },
"dependencies": { "dependencies": {
"@coingecko/cryptoformat": "^0.4.2", "@coingecko/cryptoformat": "^0.4.2",
@ -60,6 +60,7 @@
"gatsby-transformer-remark": "^2.16.1", "gatsby-transformer-remark": "^2.16.1",
"gatsby-transformer-sharp": "^2.12.1", "gatsby-transformer-sharp": "^2.12.1",
"graphql": "14.7.0", "graphql": "14.7.0",
"graphql-schema-typescript": "^1.5.2",
"is-url-superb": "^6.0.0", "is-url-superb": "^6.0.0",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"lodash.debounce": "^4.0.8", "lodash.debounce": "^4.0.8",
@ -88,6 +89,11 @@
"yup": "^0.32.9" "yup": "^0.32.9"
}, },
"devDependencies": { "devDependencies": {
"@graphql-codegen/cli": "1.21.6",
"@graphql-codegen/introspection": "1.18.2",
"@graphql-codegen/typescript": "1.22.4",
"@graphql-codegen/typescript-operations": "1.18.3",
"@graphql-codegen/typescript-react-apollo": "2.3.0",
"@svgr/webpack": "^5.5.0", "@svgr/webpack": "^5.5.0",
"@testing-library/jest-dom": "^5.12.0", "@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7", "@testing-library/react": "^11.2.7",

View File

@ -16,6 +16,6 @@ async function generateGraphSchema() {
'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph', 'https://subgraph.rinkeby.oceanprotocol.com/subgraphs/name/oceanprotocol/ocean-subgraph',
query query
) )
generateTypeScriptTypes(response.data.data, './src/@types/schema.json') // generateTypeScriptTypes(response.data.data, './src/@types/schema.json')
// fs.writeFileSync('./src/@types/schema.json', JSON.stringify(response.data)) fs.writeFileSync('./src/@types/schema.json', JSON.stringify(response.data))
} }

File diff suppressed because it is too large Load Diff

View File

@ -3,8 +3,9 @@ import { DDO, BestPrice } from '@oceanprotocol/lib'
import { getUrqlClientInstance } from '../providers/UrqlProvider' import { getUrqlClientInstance } from '../providers/UrqlProvider'
import { getOceanConfig } from './ocean' import { getOceanConfig } from './ocean'
import web3 from 'web3' import web3 from 'web3'
import schema from '../../src/@types/schema.json'
import { AssetsFreePrice } from '../@types/apollo/AssetsFreePrice' import { AssetsFreePrice } from '../@types/apollo/AssetsFreePrice'
import { AssetPreviousOrder } from '../@types/apollo/AssetPreviousOrder'
// import {AssetsFreePrice} from '../@types/graph.types'
export interface PriceList { export interface PriceList {
[key: string]: string [key: string]: string