|
1 | | -# gnd npm wrapper |
| 1 | +# Graph Node Development CLI |
2 | 2 |
|
3 | | -This directory contains the files used to publish the `@graphprotocol/gnd` |
4 | | -npm wrapper package. The wrapper package enables installing gnd via npm: |
| 3 | +This package installs the CLI for developing subgraphs for [The Graph |
| 4 | +Network](https://thegraph.com/subgraphs/) It supports all aspects of |
| 5 | +[developing, testing, and deploying subgraphs](https://thegraph.com/docs/en/subgraphs/quick-start/) locally and |
| 6 | +on the network. |
5 | 7 |
|
6 | | -```bash |
7 | | -npm install -g @graphprotocol/gnd |
8 | | -npx @graphprotocol/gnd |
9 | | -``` |
| 8 | +This package is a complete replacement for the older |
| 9 | +[graph-cli](https://www.npmjs.com/package/@graphprotocol/graph-cli) which |
| 10 | +will over time be migrated to be a simple wrapper for `gnd`. Older |
| 11 | +documentation will reference `graph-cli` in its instructions; running |
| 12 | +`alias graph=gnd` in the shell make it possible to follow these |
| 13 | +instructions verbatim with `gnd`. |
10 | 14 |
|
11 | | -## How it works |
| 15 | +Besides the tools to develop subgraphs, `gnd` also contains a version of |
| 16 | +[graph-node](https://github.com/graphprotocol/graph-node) tailored to |
| 17 | +running subgraphs locally via `gnd dev`. |
12 | 18 |
|
13 | | -The wrapper declares platform-specific packages as `optionalDependencies`. |
14 | | -npm only installs the one matching the user's OS and architecture. The |
15 | | -`bin/gnd.js` script resolves and executes the correct platform binary. |
16 | 19 |
|
17 | | -Platform packages: |
| 20 | +## Getting started |
18 | 21 |
|
19 | | -- `@graphprotocol/gnd-linux-x64` |
20 | | -- `@graphprotocol/gnd-linux-arm64` |
21 | | -- `@graphprotocol/gnd-darwin-x64` |
22 | | -- `@graphprotocol/gnd-darwin-arm64` |
23 | | -- `@graphprotocol/gnd-win32-x64` |
| 22 | +Run `npm install -g @graphprotocol/gnd` to install `gnd`. |
24 | 23 |
|
25 | | -## Publishing |
| 24 | +After installation, you can create and run an example subgraph locally with |
| 25 | +```bash |
| 26 | +gnd init --from-example ethereum-gravatar 'My new subgraph' new-subgraph |
| 27 | +cd new-subgraph |
| 28 | +gnd codegen |
| 29 | +gnd build |
| 30 | +gnd dev --ethereum-rpc 'mainnet:<RPC URL>' |
| 31 | +``` |
26 | 32 |
|
27 | | -All packages are published automatically by the `Build gnd Binaries` |
28 | | -GitHub Actions workflow (`.github/workflows/gnd-binary-build.yml`) when |
29 | | -dispatched on a tag. Platform packages are published first, then the |
30 | | -wrapper. |
| 33 | +If you have an existing contract for which you want to write a subgraph, |
| 34 | +have a look at `gnd help init` and the `--from-contract` option. You can |
| 35 | +also simply run `gnd init` and follow the prompts to set up your subgraph. |
0 commit comments