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

docs(cli): add worldgen to newdocs #1883

Merged
merged 5 commits into from
Nov 13, 2023
Merged
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
33 changes: 33 additions & 0 deletions next-docs/pages/cli/worldgen.mdx
Original file line number Diff line number Diff line change
@@ -1 +1,34 @@
# mud worldgen

Autogenerate the MUD World interface based on Systems registered in the World.

Use the `System`s under `src`<sup>1</sup> to generate the Solidity interface definitions for those `Systems` and put them in `src/codegen/world`.
Also, create `src/codegen/world/IWorld.sol` which imports all the `System` interfaces.

(1) By default this is any file that ends with `...System.sol`, for example `IncrementSystem.sol`.
However, in the config file you can specify additional `System`s, under `systems`, as well as exclude files that end in `..System.sol`, by putting them under `excludeSystems`.

## Sample usage

```sh copy
pnpm mud worldgen
```

## Options

These are the command line options you can specify on `mud worldgen`:

| Option | Meaning | Type | Default value |
| -------------- | ------------------------------------------------------------- | ------- | --------------- |
| `--version` | Show version number | boolean | `false` |
| `--configPath` | Path to the config file | string | `mud.config.ts` |
| `--clean` | Clear the worldgen directory before generating new interfaces | boolean | `true` |
| `--help` | Show help | boolean | `false` |

## Debugging

To generate debug messages, use this command:

```sh copy
export DEBUG=mud:common:codegen
```

Unchanged files with check annotations Beta

network: { components, latestBlock$, worldContract, waitForTransaction },
} = await setup();
const _window = window as any;

Check warning on line 9 in e2e/packages/client-vanilla/src/index.ts

GitHub Actions / Run tests

Unexpected any. Specify a different type
_window.worldContract = worldContract;
_window.waitForTransaction = waitForTransaction;
export type SystemCalls = ReturnType<typeof createSystemCalls>;
export function createSystemCalls(network: SetupNetworkResult, components: ClientComponents) {

Check warning on line 6 in e2e/packages/client-vanilla/src/mud/createSystemCalls.ts

GitHub Actions / Run tests

'network' is defined but never used

Check warning on line 6 in e2e/packages/client-vanilla/src/mud/createSystemCalls.ts

GitHub Actions / Run tests

'components' is defined but never used
return {
// TODO
};
const context = [functionName, args, serialize.toString(), deserialize.toString()] as const;
const serializedValue = await page.evaluate(async ([functionName, args, serializeString, deserializeString]) => {
const _serialize = deserializeFunction(serializeString);
const _deserialize = deserializeFunction(deserializeString);

Check warning on line 17 in e2e/packages/sync-test/data/callPageFunction.ts

GitHub Actions / Run tests

'_deserialize' is assigned a value but never used
const value = await (window as any)[functionName](...args);

Check warning on line 18 in e2e/packages/sync-test/data/callPageFunction.ts

GitHub Actions / Run tests

Unexpected any. Specify a different type
const serializedValue = value ? _serialize(value) : undefined;
return serializedValue;
export function callWorld<TMethod extends WriteMethodName>(page: Page, method: TMethod, args?: WriteArgs<TMethod>) {
return page.evaluate(
([_method, _args]) => {
const worldContract = (window as any).worldContract as WorldContract;

Check warning on line 17 in e2e/packages/sync-test/data/callWorld.ts

GitHub Actions / Run tests

Unexpected any. Specify a different type
const writeMethod = worldContract.write[_method as any];

Check warning on line 18 in e2e/packages/sync-test/data/callWorld.ts

GitHub Actions / Run tests

Unexpected any. Specify a different type
return writeMethod(_args)
.then((tx) => window["waitForTransaction"](tx))
.catch((error) => {
import React from "react";

Check warning on line 1 in examples/minimal/packages/client-phaser/src/ui/Wrapper.tsx

GitHub Actions / Run tests

'React' is defined but never used
import styled from "styled-components";
export const Wrapper = styled.div`
import React, { useEffect, useMemo } from "react";

Check warning on line 1 in examples/minimal/packages/client-phaser/src/ui/hooks/useNetworkLayer.tsx

GitHub Actions / Run tests

'React' is defined but never used
import { createNetworkLayer } from "../../layers/network/createNetworkLayer";
import { usePromiseValue } from "./usePromiseValue";
import React, { useCallback, useEffect, useMemo, useRef, useState } from "react";

Check warning on line 1 in examples/minimal/packages/client-phaser/src/ui/hooks/usePhaserLayer.tsx

GitHub Actions / Run tests

'React' is defined but never used
import useResizeObserver, { ResizeHandler } from "use-resize-observer";
import { throttle } from "lodash";
import { createPhaserLayer } from "../../layers/phaser/createPhaserLayer";