graphprotocol / graph-tooling

Monorepo for various tools used by subgraph developers.
https://thegraph.com/docs
Apache License 2.0
389 stars 207 forks source link

[Feature] Add mappings to --watch command #694

Open pi0neerpat opened 3 years ago

pi0neerpat commented 3 years ago

Feature

Changes to mapping files should trigger a re-deploy when using graph deploy --watch

Potential solution

Add the mappings folder here: https://github.com/graphprotocol/graph-cli/blob/67fcc903cf2ce00463812a94ce81e6262e37371f/src/compiler.js#L130

pi0neerpat commented 3 years ago

Seems like this was the original intention (https://github.com/graphprotocol/graph-cli/issues/79#issue-346711442) but for some reason only changes to the subgraph.yaml trigger deployment

schmidsi commented 3 years ago

Theoretically it should recompile if you change a mapping file:

https://github.com/graphprotocol/graph-cli/blob/master/src/compiler.js#L131-L137

As I understand that code snipped, it does not recompile if you change a file that is not directly referenced in subgraph.yaml but imported. Can you confirm this?

pi0neerpat commented 3 years ago

Well it actually doesn't recompile for any files referenced in subgraph.yaml. Only directly changing subgraph.yaml triggers re-compile. Maybe this is a bug?

@graphprotocol/graph-cli v0.18.0

Working here currently: https://github.com/superfluid-finance/protocol-monorepo/tree/subgraph-token-tracking-improvements/packages/subgraph.

"watch": "graph deploy superfluid-test --node http://localhost:8020/ --ipfs http://localhost:5001 --watch"

What I would like is for all relevant files in /mappings/ to trigger recompile.

schmidsi commented 3 years ago

What I would like is for all relevant files in /mappings/ to trigger recompile.

I agree. Added it to our backlog.