Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to use pnpx and pnpm everywhere for envio command. #526

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/HyperIndex/Advanced/generated-files.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ slug: /generated-files

# Generated files

The `/generated` directory contains essential files required for performing the indexing process in Envio. These files are automatically generated using the `envio codegen` CLI command and they should NOT be modified by the end user.
The `/generated` directory contains essential files required for performing the indexing process in Envio. These files are automatically generated using the `pnpm envio codegen` CLI command and they should NOT be modified by the end user.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `/generated` directory contains essential files required for performing the indexing process in Envio. These files are automatically generated using the `pnpm envio codegen` CLI command and they should NOT be modified by the end user.
The `/generated` directory contains essential files required for performing the indexing process in Envio. These files are automatically generated using the `pnpm codegen` CLI command and they should NOT be modified by the end user.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we maybe even skip envio and have pnpm codegen?


If indexing errors occur, they are likely a result of issues in the generated files, which may point to an incorrect specification in the setup files (`config.yaml`, `schema.graphql` and `EventHandlers.*`)

Once all setup file errors have been resolved, you can rerun the `envio codegen` command to re-generate the necessary indexing files.
Once all setup file errors have been resolved, you can rerun the `pnpm envio codegen` command to re-generate the necessary indexing files.

The variables used in the generated files adhere to the names specified in the configuration and schema files during the initial setup. This ensures consistency between the generated files and the contracts, events, and entities defined in the configuration and schema.

The generated files are initially created in ReScript and then compiled to JavaScript (`.bs.js` extension) for runtime execution.


---
---
2 changes: 1 addition & 1 deletion docs/HyperIndex/Advanced/performance/benchmarking.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ slug: /benchmarking

### Capturing the benchmark

You can run `envio start --bench` to capture some benchmarking data while your indexer is running. This should not be run in production, since it holds each benchmark data point in memory and adds some overhead in writing to a file.
You can run `pnpm envio start --bench` to capture some benchmarking data while your indexer is running. This should not be run in production, since it holds each benchmark data point in memory and adds some overhead in writing to a file.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only downside of dropping envio and having only pnpm start is that flags won't work in this case.


### Printing the benchmark

Expand Down
2 changes: 1 addition & 1 deletion docs/HyperIndex/Examples/example-ens.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ The indexer has been built using v0.0.37 of Envio.
3. Install with `pnpm i`
4. Generate indexing code via `pnpm envio codegen`
5. Run the indexer via `pnpm envio dev` (make sure you have Docker running)
6. Stop the indexer via `envio stop`
6. Stop the indexer via `pnpm envio stop`
6 changes: 3 additions & 3 deletions docs/HyperIndex/Examples/example-liquidation-metrics.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ The indexer has been built using v0.0.21 of Envio.
1. Clone the [repo](https://github.com/enviodev/liquidation-metrics)
2. Install any other pre-requisite packages for Envio listed [here](https://docs.envio.dev/docs/installation#prerequisites)
3. Install Envio via `npm i -g [email protected]`
4. Generate indexing code via `envio codegen`
5. Run the indexer via `envio dev` (make sure you have Docker running)
6. Stop the indexer via `envio stop`
4. Generate indexing code via `pnpm envio codegen`
5. Run the indexer via `pnpm envio dev` (make sure you have Docker running)
6. Stop the indexer via `pnpm envio stop`
6 changes: 3 additions & 3 deletions docs/HyperIndex/Examples/example-uniswap-v3.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@ The indexer has been built using v0.0.21 of Envio.
1. Clone the [repo](https://github.com/enviodev/uniV3-swaps)
1. Install any other pre-requisite packages for Envio listed [here](https://docs.envio.dev/docs/installation#prerequisites)
1. Install Envio via `npm i -g [email protected]`
1. Generate indexing code via `envio codegen`
1. Run the indexer via `envio dev` (make sure you have Docker running)
1. Stop the indexer via `envio stop`
1. Generate indexing code via `pnpm envio codegen`
Comment on lines 23 to +24
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong

1. Run the indexer via `pnpm envio dev` (make sure you have Docker running)
1. Stop the indexer via `pnpm envio stop`
2 changes: 2 additions & 0 deletions docs/HyperIndex/Guides/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ slug: /cli-commands

This document contains the help content for the `envio` command-line program.

**_Note:_** `envio` is an executable, but it is recommended to always run `pnpx envio@latest` for the init command and `pnpm envio` when interacting with a specific repo. This ensures that you are using an up to date version for new projects, and use the correct version of the envio executable for local project you may look at.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only file that I did not add pnpm or pnpx to.


**Command Overview:**

* [`envio`↴](#envio)
Expand Down
2 changes: 1 addition & 1 deletion docs/HyperIndex/Guides/configuration-file.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Once you have set up your config file and the [schema](./schema-file.md), you ar
Run the following command:

```bash
envio codegen
pnpm envio codegen
```

## Contract Addresses
Expand Down
2 changes: 1 addition & 1 deletion docs/HyperIndex/Guides/event-handlers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import TabItem from "@theme/TabItem";
Once the configuration and schema files are in place, run:

```bash
envio codegen
pnpm envio codegen
```

in the project directory to generate the functions you will use in your handlers.
Expand Down
4 changes: 2 additions & 2 deletions docs/HyperIndex/Guides/hyperindex-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ The following files are required from the user to run HyperIndex:
- GraphQL Schema (defaults to `schema.graphql`)
- Event Handlers (defaults to `src/EventHandlers.*` depending on the language chosen)

These files are auto-generated according to the template and language chosen by running the `envio init` command.
These files are auto-generated according to the template and language chosen by running the `pnpx envio@latest init` command.

Click [here](../getting-started.md) for a Quickstart guide on how to get started.

---
---
2 changes: 1 addition & 1 deletion docs/HyperIndex/Guides/ipfs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This guide assumes you are familiar with IPFS, however [jump](#what-is-ipfs) to

First, we create an indexer using the Envio contract import feature.

`npx envio init`
`npx pnpx envio@latest init`
Contract address: `0xBC4CA0EdA7647A8aB7C2061c2E118A18a936f13D`

We then make some light modifications. The resulting config, schema, and event handlers look as follows.
Expand Down
6 changes: 3 additions & 3 deletions docs/HyperIndex/Guides/running-locally.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ slug: /running-locally

## Starting the Indexer

Remember to `cd` into your project directory if you have defined one during `envio init`.
Remember to `cd` into your project directory if you have defined one during `pnpx envio@latest init`.

Before running the Envio CLI command to start the indexer locally, please make sure you have [Docker](https://www.docker.com/products/docker-desktop/) running.

Run the indexer

```bash
envio dev
pnpm envio dev
```

This will automatically open up the Hasura dashboard where you can view the data that has been indexed.
Expand All @@ -26,7 +26,7 @@ Admin-secret / password for local Hasura is `testing`.
To delete the docker images used for the local development environment, run

```bash
envio stop
pnpm envio stop
```

## What next?
Expand Down
4 changes: 2 additions & 2 deletions docs/HyperIndex/Guides/schema-file.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ In GraphQL, scalars represent fundamental data types such as strings and numbers

You can find out more on GraphQL [here](https://graphql.org/learn/).

Once you have set up your config and schema file you can run `envio codegen` to generate the functions that you will use in your handlers.
Once you have set up your config and schema file you can run `pnpm envio codegen` to generate the functions that you will use in your handlers.

```bash
envio codegen
pnpm envio codegen
```

## Defining One-to-Many Relationships
Expand Down
6 changes: 3 additions & 3 deletions docs/HyperIndex/Guides/testing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Tests are written in JavaScript, TypeScript, and ReScript for the Greeter templa
Generate `greeter` template in TypeScript using Envio CLI

```bash
envio init template -l typescript -d greeter -t greeter -n greeter
pnpx envio@latest init template -l typescript -d greeter -t greeter -n greeter
```

Run tests
Expand Down Expand Up @@ -81,10 +81,10 @@ Add a test command to your `package.json`
"test": "mocha",
```

Make sure to run `envio codegen` when changes are made to the config or schema files to regenerate the testing library (`TestHelpers` file).
Make sure to run `pnpm envio codegen` when changes are made to the config or schema files to regenerate the testing library (`TestHelpers` file).

```bash
envio codegen
pnpm envio codegen
```

## Writing tests
Expand Down
20 changes: 9 additions & 11 deletions docs/HyperIndex/Troubleshoot/common-issues.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ slug: /common-issues

# Common issues

## `Cannot find module` errors on `envio start`
## `Cannot find module` errors on `pnpm envio start`

This error indicates that the indexer is unable to find the necessary files to start the indexer.

Delete the `generated` folder and run

```bash
envio codegen
pnpm envio codegen
```

> Always run `envio codegen` straight after cloning an indexer repo using Envio.
> Always run `pnpm envio codegen` straight after cloning an indexer repo using Envio.

## Indexer not starting at the specified start block

Expand All @@ -26,13 +26,13 @@ If the indexer starts running but does not index the smart contracts from the `s
Run

```bash
envio stop
pnpm envio stop
```

and then

```bash
envio dev
pnpm envio dev
```

## Tables for entities are not registered on Hasura
Expand All @@ -42,13 +42,13 @@ Should the tables for the entities outlined in the schema file not show up on Ha
Run

```bash
envio stop
pnpm envio stop
```

and then

```bash
envio dev
pnpm envio dev
```

## Postgres running locally
Expand All @@ -58,16 +58,14 @@ If Postgres is running locally on port 5432, then you can run the whole system w
In practice, this could look like this:

```
ENVIO_PG_PORT=5433 envio codegen
ENVIO_PG_PORT=5433 envio dev
ENVIO_PG_PORT=5433 pnpm envio codegenENVIO_PG_PORT=5433 pnpm envio dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken

```

or

```
export ENVIO_PG_PORT=5433
envio codegen
envio dev
pnpm envio codegenpnpm envio dev
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken

```

NOTE: you can further customize how you connect to Postgres with these additional environment variables `ENVIO_POSTGRES_PASSWORD`, `ENVIO_PG_USER`, and `ENVIO_PG_DATABASE`.
Expand Down
2 changes: 1 addition & 1 deletion docs/HyperIndex/Troubleshoot/error-codes.md
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ Contact us in our [Discord](https://discord.gg/Q9qt8gZ2fX) for further assistanc
For all of the database-related errors, rerun DB migrations using the following command:

```bash
envio local db-migrate setup
pnpm envio local db-migrate setup
```

### `EE700`: Parse DB Row
Expand Down
4 changes: 2 additions & 2 deletions docs/HyperIndex/Tutorials/greeter-tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Initialize the project using the Greeter template.
Run

```bash
envio init
pnpx envio@latest init
```

Choose the directory where you would like to set up your project (default is the current directory)
Expand Down Expand Up @@ -89,7 +89,7 @@ The following commands will start the docker and create databases for indexed da
Run

```bash
envio dev
pnpm envio dev
```

The indexer will then start indexing the contract's specified in the `config.yaml` file from the `start_block` specified for each network.
Expand Down
6 changes: 3 additions & 3 deletions docs/HyperIndex/Tutorials/tutorial-erc20-token-transfers.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Before we start indexing, you'll need to make sure you have the [prerequisites](

Now that you’re all set up and have installed the prerequisite packages required, let’s jump into the practical steps of initializing the indexer and generating a boilerplate index to index the largest USDC token transfers on Base.

1. Open your terminal in an empty repository and run the command ‘**envio init.**’
1. Open your terminal in an empty repository and run the command ‘**pnpx envio@latest init.**’

<img src="/docs-assets/tutorial-base-erc20-transfer-1.png" alt="tutorial-base-erc20-transfer-1" width="100%"/>

Expand Down Expand Up @@ -55,13 +55,13 @@ Before starting your indexer, run the command below to ensure that no conflictin

### Stopping the indexer

`envio stop`
`pnpm envio stop`

> Note: Ignore if you’re a first-time user.

### Start the indexer

`envio dev`
`pnpm envio dev`

Now, let's run our indexer locally by running the command below.

Expand Down
2 changes: 1 addition & 1 deletion docs/HyperIndex/Tutorials/tutorial-indexing-fuel.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Now that you have installed the prerequisite packages let's begin the practical
Open your terminal in an empty directory and initialize a new indexer by running the command:

```bash
npx envio init
npx pnpx envio@latest init
```

In the following prompt, choose the directory where you want to set up your project. The default is the current directory, but in the tutorial, I'll use the indexer name:
Expand Down
6 changes: 3 additions & 3 deletions docs/HyperIndex/Tutorials/tutorial-op-bridge-deposits.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Before we start indexing, you'll need to make sure you have the [prerequisites](

Now that you have installed the prerequisite packages required, let’s jump into the practical steps of setting up the indexer.

1. Open your terminal in an empty repository and initialize a new indexer by running the command ‘envio init’
1. Open your terminal in an empty repository and initialize a new indexer by running the command ‘pnpx envio@latest init’
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd skip latest for simplicity, as I understand it works good with pnpx


<img src="/docs-assets/tutorial-op-bridge-1.png" alt="tutorial-op-bridge-1" width="100%"/>

Expand Down Expand Up @@ -59,13 +59,13 @@ Before starting your indexer, run the command below to ensure that no conflictin

### Stopping the indexer:

`envio stop`
`pnpm envio stop`

> Note: Ignore if you’re a first-time user.

### Start the indexer:

`envio dev`
`pnpm envio dev`

Now, let's run our indexer locally by running the command below.

Expand Down
4 changes: 2 additions & 2 deletions docs/HyperIndex/contract-import.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ slug: /contract-import

The Quickstart allows you to instantly autogenerate a basic indexer and query your data. This is the quickest way to get going and likely the starting point for most developers.

For example, you could autogenerate an indexer for Eigenlayer AND index the entire Eigenlayer contract in under 5 minutes simply through running `envio init` and pasting the contract address from the Block Explorer: https://etherscan.io/address/0x858646372cc42e1a627fce94aa7a7033e7cf075a
For example, you could autogenerate an indexer for Eigenlayer AND index the entire Eigenlayer contract in under 5 minutes simply through running `pnpx envio@latest init` and pasting the contract address from the Block Explorer: https://etherscan.io/address/0x858646372cc42e1a627fce94aa7a7033e7cf075a

<iframe width="560" height="315" src="https://www.youtube.com/embed/zkVlGgf5XAo" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

Expand All @@ -18,7 +18,7 @@ For example, you could autogenerate an indexer for Eigenlayer AND index the enti
To start, simply run:

```
envio init
pnpx envio@latest init
```

After selecting the name, directory and preferred language for the indexer, choose `Contract Import` as the initialization option.
Expand Down
2 changes: 1 addition & 1 deletion docs/HyperIndex/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ More information on [the Quickstart](./contract-import) can be found in this doc

### Templates

Select either the `ERC20`, `Greeter`, or `Blank` template following the `envio init` command.
Select either the `ERC20`, `Greeter`, or `Blank` template following the `pnpx envio
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Broken


More information on [the `Greeter` template](./greeter-tutorial) is available.

Expand Down
6 changes: 3 additions & 3 deletions docs/unused/example-aave-token.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ The indexer has been built using v0.0.21 of Envio.
1. Clone the [repo](https://github.com/enviodev/aave-token-mainnet-events)
1. Install any other pre-requisite packages for Envio listed [here](https://docs.envio.dev/docs/installation#prerequisites)
1. Install Envio via `npm i -g [email protected]`
1. Generate indexing code via `envio codegen`
1. Run the indexer via `envio dev` (make sure you have Docker running)
1. Stop the indexer via `envio stop`
1. Generate indexing code via `pnpm envio codegen`
1. Run the indexer via `pnpm envio dev` (make sure you have Docker running)
1. Stop the indexer via `pnpm envio stop`
6 changes: 3 additions & 3 deletions docs/unused/example-erc4626-token-vault.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ The indexer has been built using v0.0.22 of Envio.
1. Clone the [repo](https://github.com/enviodev/erc4626-token-vault-indexer)
1. Install any other pre-requisite packages for Envio listed [here](https://docs.envio.dev/docs/installation#prerequisites)
1. Install Envio via `npm i -g [email protected]`
1. Generate indexing code via `envio codegen`
1. Run the indexer via `envio dev` (make sure you have Docker running)
1. Stop the indexer via `envio stop`
1. Generate indexing code via `pnpm envio codegen`
1. Run the indexer via `pnpm envio dev` (make sure you have Docker running)
1. Stop the indexer via `pnpm envio stop`
6 changes: 3 additions & 3 deletions docs/unused/example-on-chain-governance.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ The indexer has been built using 0.0.20 of Envio.
1. Clone the [repo](https://github.com/enviodev/onchain-governance-indexer)
1. Install any other pre-requisite packages for Envio listed [here](https://docs.envio.dev/docs/installation#prerequisites)
1. Install Envio via `npm i -g [email protected]`
1. Generate indexing code via `envio codegen`
1. Run the indexer via `envio dev` (make sure you have Docker running)
1. Stop the indexer via `envio stop`
1. Generate indexing code via `pnpm envio codegen`
1. Run the indexer via `pnpm envio dev` (make sure you have Docker running)
1. Stop the indexer via `pnpm envio stop`
6 changes: 3 additions & 3 deletions docs/unused/example-reNFT.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,6 @@ The indexer has been built using v0.0.21 of Envio.
1. Clone the [repo](https://github.com/enviodev/reNFT-index)
1. Install any other pre-requisite packages for Envio listed [here](https://docs.envio.dev/docs/installation#prerequisites)
1. Install Envio via `npm i -g [email protected]`
1. Generate indexing code via `envio codegen`
1. Run the indexer via `envio dev` (make sure you have Docker running)
1. Stop the indexer via `envio stop`
1. Generate indexing code via `pnpm envio codegen`
1. Run the indexer via `pnpm envio dev` (make sure you have Docker running)
1. Stop the indexer via `pnpm envio stop`
Loading