Skip to content

Commit

Permalink
update explorer readme
Browse files Browse the repository at this point in the history
  • Loading branch information
karooolis committed Aug 29, 2024
1 parent c1bf7d3 commit eaf5f71
Showing 1 changed file with 42 additions and 36 deletions.
78 changes: 42 additions & 36 deletions packages/explorer/README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,56 @@
# World Explorer

World Explorer is a GUI tool designed for visually exploring and manipulating the state of worlds.
For the full information about it, [see the docs](http://mud.dev/world-explorer).

## Getting started
## Installation

1. **Install the package**
Starting with MUD 2.2, the MUD templates come with the World Explorer installed.

```sh
pnpm add @latticexyz/explorer
```
These instructions are how to use World Explorer on earlier versions of MUD.

2. **Start a local development chain**
The easiest way to get World Explorer for earlier MUD versions is to create a project with the new template.

Ensure you have a local development chain running.
1. Create a project with the new template, which has World Explorer. Then, delete the files you no longer need.

3. **Run the World Explorer**
```sh copy
pnpm create mud@main explorer --template vanilla
cd explorer
rm -rf packages/client packages/contracts/[st]*
```

```sh
npx @latticexyz/explorer --worldAddress <YOUR_WORLD_ADDRESS>
2. Edit `mprocs.yaml` to remove the definitions for `client`, `contracts`, and `anvil`.

```yaml filename="mprocs.yaml" copy
procs:
indexer:
cwd: packages/contracts
shell: rimraf $SQLITE_FILENAME && pnpm sqlite-indexer
env:
RPC_HTTP_URL: "http://127.0.0.1:8545"
FOLLOW_BLOCK_TAG: "latest"
SQLITE_FILENAME: "indexer.db"
explorer:
cwd: packages/contracts
shell: pnpm explorer
```

Alternatively, if you have a worlds configuration file:
3. Replace `packages/contracts/worlds.json` with a link to the original project's `worlds.json`.
```sh
npx @latticexyz/explorer --worldsConfigPath <PATH_TO_WORLDS_CONFIG>
```sh copy
cp packages/contracts
rm worlds.json
ln -s <the original project>/packages/contracts/worlds.json .
cd ../..
```
Note: You can use `@latticexyz/store-indexer` for indexing your world's data.
4. Run the new project.
```sh copy
pnpm dev
```
5. Browse to [World Explorer](http://localhost:13690).
## CLI arguments
Expand All @@ -35,45 +59,27 @@ The World Explorer accepts the following CLI arguments:
| Argument | Description | Default value |
| ----------------- | -------------------------------------------------------------------------------- | ------------- |
| `worldAddress` | The address of the world to explore | None |
| `worldsFile` | Path to a worlds configuration file (used to resolve world address) | None |
| `worldsFile` | Path to a worlds configuration file (used to resolve world address) | "worlds.json" |
| `indexerDatabase` | Path to your SQLite indexer database | "indexer.db" |
| `chainId` | The chain ID of the network | 31337 |
| `port` | The port on which to run the World Explorer | 13690 |
| `env` | The environment to run the World Explorer in (e.g., "development", "production") | "production" |
## Example setup
An example setup is provided in the `examples/local-explorer` directory, demonstrating a full setup for using the World Explorer in a local development environment:
1. **Setup**
```sh
cd examples/local-explorer && pnpm install
```
2. **Run**
```sh
pnpm dev
```
This command starts all necessary processes, including a local chain, indexer, and the explorer.
## Contributing
To contribute to or modify the World Explorer, the easiest way is to run the example setup in `development` mode:
To contribute to World Explorer, first follow the [MUD contribution guidelines](https://mud.dev/contribute). The best way to edit the World Explorer is to run the example setup in `development` mode:
1. **Setup**
Navigate to the `examples/local-explorer` directory and locate the `mprocs.yaml` file.
2. **Configure**
In `mprocs.yaml`, ensure the `explorer` command is set up correctly. For example:
In `mprocs.yaml`, ensure the `explorer` command is set to run the World Explorer in `development` mode.
```yaml
explorer:
shell: pnpm explorer --worldsConfigPath packages/contracts/worlds.json --env development
shell: pnpm explorer --env development
```
3. **Run**
Expand Down

0 comments on commit eaf5f71

Please sign in to comment.