-
Notifications
You must be signed in to change notification settings - Fork 203
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(cli): support and document debugging
- Loading branch information
1 parent
9e1af4c
commit a5b96a3
Showing
3 changed files
with
37 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,31 @@ | ||
# cli | ||
|
||
docs coming soon | ||
## Usage | ||
|
||
See usage documentation on the [MUD docs](https://mud.dev/cli/tablegen). | ||
|
||
## Development | ||
|
||
### Debugging | ||
|
||
The CLI can be run in a debug environment: | ||
|
||
1. Set the `MUD_PACKAGES` environment variable (see `tsup.config.ts`) | ||
```bash | ||
export MUD_PACKAGES=$(tsx ./scripts/log-mud-packages) | ||
``` | ||
2. Setup your debugger with `tsx` as the TypeScript loader and `src/mud.ts` as the entrypoint | ||
3. Set the arguments to whichever command you want to run (e.g. `deploy`) and its options. | ||
- Important: add the `--configPath` option as the path of your project's `mud.config.ts` file, because the current working directory will otherwise be the CLI source. | ||
|
||
The CLI should now run in your debugger with TypeScript support. | ||
|
||
### Production build | ||
|
||
The project can be built for production with `tsup`: | ||
|
||
```bash | ||
pnpm build | ||
``` | ||
|
||
`pnpm link` can be used to run the locally-built package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import defineConfig from "../tsup.config"; | ||
|
||
// Log out the MUD_PACKAGES env var so it can be used to run the CLI in development mode | ||
// @ts-expect-error: defineConfig return type is not properly inferred | ||
console.log(defineConfig({}).env.MUD_PACKAGES); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters