Skip to content

Commit

Permalink
refactor: cleanup package.json for subgraphs
Browse files Browse the repository at this point in the history
  • Loading branch information
coreyar committed Oct 30, 2023
1 parent 25f225a commit e6f90c5
Show file tree
Hide file tree
Showing 13 changed files with 172 additions and 1,137 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ Integration tests require running IPFS, a graph-node and a hardhat node. They ca
$ yarn workspace <WORKSPACE> run test:integration
```

If you'd like to run the integration tests locally include the env `LOCAL=true` and follow instructions run the services locally.

> Integration tests are temporarily disabled during CI, while the docker setup is debugged.
## Running servies locally
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"prepare:local": "yarn workspaces foreach run prepare:local",
"prepare:testnet": "yarn workspaces foreach run prepare:testnet",
"prepare:mainnet": "yarn workspaces foreach run prepare:mainnet",
"remove:local": "yarn workspaces foreach run remove:local",
"generate-subgraph-types": "yarn workspaces foreach run generate-subgraph-types",
"lint": "eslint '**/*.{ts,tsx}'",
"lint:fix": "yarn lint --fix",
Expand Down
6 changes: 0 additions & 6 deletions subgraphs/isolated-pools/babel.config.js

This file was deleted.

File renamed without changes.
28 changes: 7 additions & 21 deletions subgraphs/isolated-pools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,22 @@
],
"scripts": {
"codegen": "npx graph codegen",
"create:local": "LOCAL=true npx graph create venusprotocol/venus-isolated-pools --node http://127.0.0.1:8020/",
"build:local": "LOCAL=true npx graph build --ipfs http://127.0.0.1:5001",
"create:docker": "npx graph create venusprotocol/venus-isolated-pools --node http://graph-node:8020/",
"build:docker": "npx graph build --ipfs http://ipfs:5001",
"build:bsc": "npx graph build --ipfs https://api.thegraph.com/ipfs/ ",
"deploy:local": "LOCAL=true npx mustache config/local.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020/",
"deploy:docker": "npx mustache config/local.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --ipfs http://ipfs:5001 --node http://graph-node:8020/ --version-label ci",
"deploy:chapel": "npx mustache config/chapel.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools-chapel --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:bsc": "npx mustache config/bsc.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:sepolia": "npx prepare:sepolia && npx graph deploy --studio venus-isolated-pools-sepolia",
"prepare:local": "npx mustache config/local.json template.yaml > subgraph.yaml && npx mustache config/local.json src/constants/config-template > src/constants/config.ts",
"prepare:docker": "npx mustache config/local.json template.yaml > subgraph.yaml && npx mustache config/local.json src/constants/config-template > src/constants/config.ts",
"build:bsc": "graph build --ipfs https://api.thegraph.com/ipfs/ ",
"deploy:integration": "graph deploy venusprotocol/venus-isolated-pools --ipfs http://localhost:5001 --node http://127.0.0.1:8020/",
"deploy:docker": "npx mustache config/docker.json template.yaml > subgraph.yaml && npx mustache config/docker.json src/constants/config-template > src/constants/config.ts && npx graph deploy venusprotocol/venus-governance --ipfs http://ipfs:5001 --node http://graph-node:8020/ --version-label ci",
"deploy:chapel": "npx mustache config/chapel.json template.yaml > subgraph.yaml && npx mustache config/chapel.json src/constants/config-template > src/constants/config.ts && graph deploy venusprotocol/venus-governance-chapel --debug --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:bsc": "npx mustache config/bsc.json template.yaml > subgraph.yaml && npx mustache config/bsc.json src/constants/config-template > src/constants/config.ts && graph deploy venusprotocol/venus-governance --debug --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"prepare:docker": "npx mustache config/docker.json template.yaml > subgraph.yaml && npx mustache config/docker.json src/constants/config-template > src/constants/config.ts",
"prepare:chapel": "npx mustache config/chapel.json template.yaml > subgraph.yaml && npx mustache config/chapel.json src/constants/config-template > src/constants/config.ts",
"prepare:bsc": "npx mustache config/bsc.json template.yaml > subgraph.yaml && npx mustache config/bsc.json src/constants/config-template > src/constants/config.ts",
"prepare:sepolia": "npx mustache config/sepolia.json template.yaml > subgraph.yaml && npx mustache config/sepolia.json src/constants/config-template > src/constants/config.ts",
"remove:local": "npx graph remove --node http://127.0.0.1:8020/ venusprotocol/venus-isolated-pools",
"remove:docker": "npx graph remove --node http://graph-node:8020/ venusprotocol/venus-isolated-pools",
"generate-subgraph-types": "rm -rf /subgraph-client/.graphclient && yarn graphclient build --dir ./subgraph-client",
"pretty": "prettier —-write '**/*.ts'",
"test": "yarn prepare:local && graph test",
"test:integration": "PACKAGE=isolated-pools hardhat test tests/integration/index.ts --network localhost"
"test:integration": "hardhat test tests/integration/index.ts --network localhost"
},
"devDependencies": {
"@babel/preset-env": "^7.19.3",
"@babel/preset-typescript": "^7.18.6",
"@graphprotocol/client-cli": "^3.0.0",
"@openzeppelin/contracts": "^4.7.3",
"@openzeppelin/contracts-upgradeable": "^4.7.3",
"apollo-fetch": "^0.7.0",
"hardhat": "^2.10.2",
"urql": "^3.0.3",
"venus-subgraph-utils": "0.0.0"
}
Expand Down
12 changes: 4 additions & 8 deletions subgraphs/isolated-pools/tests/integration/utils/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,18 @@ import { SUBGRAPH_ACCOUNT, SUBGRAPH_NAME, SYNC_DELAY } from '../constants';

const deploy = async () => {
const root = __dirname;
const env = process.env.LOCAL ? ('local' as const) : ('docker' as const);

// Create Subgraph Connection
const subgraph = fetchSubgraph(SUBGRAPH_ACCOUNT, SUBGRAPH_NAME);

// Build and Deploy Subgraph
console.log('Build and deploy subgraph...');
exec(`yarn workspace isolated-pools-subgraph run prepare:${env}`, root);
exec(`yarn workspace isolated-pools-subgraph run prepare:docker`, root);
exec(`yarn workspace isolated-pools-subgraph run codegen`, root);
exec(`yarn workspace isolated-pools-subgraph run build:${env}`, root);
exec(`yarn workspace isolated-pools-subgraph run create:${env}`, root);
exec(`yarn workspace isolated-pools-subgraph run build:docker`, root);
exec(`yarn workspace isolated-pools-subgraph run create:docker`, root);

const deployCmd =
env === 'local'
? `npx graph deploy ${SUBGRAPH_ACCOUNT}/${SUBGRAPH_NAME} --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020/ --version-label v${Date.now().toString()}`
: `npx graph deploy ${SUBGRAPH_ACCOUNT}/${SUBGRAPH_NAME} --ipfs http://ipfs:5001 --node http://graph-node:8020/ --version-label v${Date.now().toString()}`;
const deployCmd = `npx graph deploy ${SUBGRAPH_ACCOUNT}/${SUBGRAPH_NAME} --ipfs http://ipfs:5001 --node http://graph-node:8020/ --version-label v${Date.now().toString()}`;
exec(deployCmd, root);

await waitForSubgraphToBeSynced(SYNC_DELAY);
Expand Down
9 changes: 1 addition & 8 deletions subgraphs/venus-governance/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,21 @@
],
"scripts": {
"codegen": "npx graph codegen",
"create:local": "graph create venusprotocol/venus-governance --node http://127.0.0.1:8020",
"create:docker": "npx graph create venusprotocol/venus-governance --node http://graph-node:8020/",
"build:docker": "npx graph build --ipfs http://ipfs:5001",
"build:local": "graph build --ipfs http://localhost:5001",
"build:bsc": "graph build --ipfs https://api.thegraph.com/ipfs/ ",
"deploy:integration": "graph deploy venusprotocol/venus-governance --debug --ipfs http://localhost:5001 --node http://127.0.0.1:8020/",
"deploy:local": "npx mustache config/local.json template.yaml > subgraph.yaml && npx mustache config/local.json src/constants/config-template > src/constants/config.ts && yarn deploy:integration",
"deploy:docker": "npx mustache config/local.json template.yaml > subgraph.yaml && npx mustache config/local.json src/constants/config-template > src/constants/config.ts && npx graph deploy venusprotocol/venus-governance --ipfs http://ipfs:5001 --node http://graph-node:8020/ --version-label ci",
"deploy:docker": "npx mustache config/docker.json template.yaml > subgraph.yaml && npx mustache config/docker.json src/constants/config-template > src/constants/config.ts && npx graph deploy venusprotocol/venus-governance --ipfs http://ipfs:5001 --node http://graph-node:8020/ --version-label ci",
"deploy:chapel": "npx mustache config/chapel.json template.yaml > subgraph.yaml && npx mustache config/chapel.json src/constants/config-template > src/constants/config.ts && graph deploy venusprotocol/venus-governance-chapel --debug --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:bsc": "npx mustache config/bsc.json template.yaml > subgraph.yaml && npx mustache config/bsc.json src/constants/config-template > src/constants/config.ts && graph deploy venusprotocol/venus-governance --debug --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"prepare:local": "npx mustache config/local.json template.yaml > subgraph.yaml && npx mustache config/local.json src/constants/config-template > src/constants/config.ts",
"prepare:chapel": "npx mustache config/chapel.json template.yaml > subgraph.yaml && npx mustache config/chapel.json src/constants/config-template > src/constants/config.ts",
"prepare:bsc": "npx mustache config/bsc.json template.yaml > subgraph.yaml && npx mustache config/bsc.json src/constants/config-template > src/constants/config.ts",
"remove:local": "graph remove --node http://localhost:8020/ venusprotocol/venus-governance",
"generate-subgraph-types": "yarn graphclient build --dir ./subgraph-client",
"test": "graph test",
"test:integration": "hardhat test tests/integration/index.ts --network localhost"
},
"devDependencies": {
"@graphprotocol/client-cli": "^3.0.0",
"apollo-fetch": "^0.7.0",
"hardhat": "^2.10.2",
"urql": "^3.0.3",
"venus-subgraph-utils": "0.0.0"
}
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
21 changes: 11 additions & 10 deletions subgraphs/venus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
"generated"
],
"scripts": {
"codegen": "graph codegen",
"create:local": "LOCAL=true npx graph create venusprotocol/venus-subgraph --node http://127.0.0.1:8020/",
"build:local": "LOCAL=true npx graph build --ipfs http://127.0.0.1:5001",
"build:mainnet": "npx graph build --ipfs https://api.thegraph.com/ipfs/ ",
"deploy:local": "LOCAL=true npx mustache config/local.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --debug --ipfs http://127.0.0.1:5001 --node http://127.0.0.1:8020/",
"deploy:testnet": "npx mustache config/testnet.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools-chapel --debug --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:mainnet": "npx mustache config/mainnet.json template.yaml > subgraph.yaml && npx graph deploy venusprotocol/venus-isolated-pools --debug --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"prepare:local": "npx mustache config/local.json template.yaml > subgraph.yaml",
"prepare:testnet": "npx mustache config/testnet.json template.yaml > subgraph.yaml",
"prepare:mainnet": "npx mustache config/mainnet.json template.yaml > subgraph.yaml",
"codegen": "npx graph codegen",
"create:docker": "npx graph create venusprotocol/venus-subgraph --node http://graph-node:8020/",
"build:docker": "npx graph build --ipfs http://ipfs:5001",
"build:bsc": "graph build --ipfs https://api.thegraph.com/ipfs/ ",
"deploy:integration": "graph deploy venusprotocol/venus-subgraph --debug --ipfs http://localhost:5001 --node http://127.0.0.1:8020/",
"deploy:docker": "npx mustache config/docker.json template.yaml > subgraph.yaml && npx mustache config/docker.json src/constants/config-template > src/constants/config.ts && npx graph deploy venusprotocol/venus-subgraph --ipfs http://ipfs:5001 --node http://graph-node:8020/ --version-label ci",
"deploy:chapel": "npx mustache config/chapel.json template.yaml > subgraph.yaml && npx mustache config/chapel.json src/constants/config-template > src/constants/config.ts && graph deploy venusprotocol/venus-subgraph -chapel --debug --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"deploy:bsc": "npx mustache config/bsc.json template.yaml > subgraph.yaml && npx mustache config/bsc.json src/constants/config-template > src/constants/config.ts && graph deploy venusprotocol/venus-subgraph e --debug --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/",
"prepare:docker": "npx mustache config/docker.json template.yaml > subgraph.yaml && npx mustache config/docker.json src/constants/config-template > src/constants/config.ts",
"prepare:chapel": "npx mustache config/chapel.json template.yaml > subgraph.yaml && npx mustache config/chapel.json src/constants/config-template > src/constants/config.ts",
"prepare:bsc": "npx mustache config/bsc.json template.yaml > subgraph.yaml && npx mustache config/bsc.json src/constants/config-template > src/constants/config.ts",
"test": "graph test",
"test:integration": "true"
}
Expand Down
Loading

0 comments on commit e6f90c5

Please sign in to comment.