Skip to content

Commit 195a811

Browse files
committed
docs: update messenger-docs README with monorepo and client usage
1 parent b91a407 commit 195a811

1 file changed

Lines changed: 55 additions & 13 deletions

File tree

packages/messenger-docs/README.md

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
Generate and serve Messenger API documentation for MetaMask controller packages.
44

5+
Scans TypeScript source files and declaration files for messenger action/event types, then generates a searchable Docusaurus site with per-namespace documentation.
6+
57
## Installation
68

79
`yarn add @metamask/messenger-docs`
@@ -12,27 +14,67 @@ or
1214

1315
## Usage
1416

17+
### Core monorepo
18+
19+
The package includes workspace scripts for development:
20+
1521
```bash
16-
# Default: scans cwd for node_modules/@metamask controller/service packages
17-
npx @metamask/messenger-docs
22+
# Generate docs from all packages
23+
yarn workspace @metamask/messenger-docs docs:generate
1824

19-
# Scan a specific project
20-
npx @metamask/messenger-docs /path/to/project
25+
# Generate + start dev server with hot reload
26+
yarn workspace @metamask/messenger-docs docs:dev
2127

2228
# Generate + build static site
23-
npx @metamask/messenger-docs --build
29+
yarn workspace @metamask/messenger-docs docs:build
30+
31+
# Generate + build + serve
32+
yarn workspace @metamask/messenger-docs docs:serve
33+
```
34+
35+
### Client projects (Extension, Mobile)
36+
37+
Add `@metamask/messenger-docs` as a dev dependency, then add a script to your `package.json`:
38+
39+
```json
40+
{
41+
"scripts": {
42+
"docs:messenger": "messenger-docs --serve"
43+
}
44+
}
45+
```
2446

25-
# Generate + serve (build + http server)
26-
npx @metamask/messenger-docs --serve
47+
By default, the tool scans `src/` for `.ts` files and `node_modules/@metamask/` for `.d.cts` declaration files. If your project has source files in other directories, configure `scanDirs` in `package.json`:
2748

28-
# Generate + dev server (hot reload)
29-
npx @metamask/messenger-docs --dev
49+
```json
50+
{
51+
"messenger-docs": {
52+
"scanDirs": ["app", "src"]
53+
}
54+
}
55+
```
56+
57+
Or pass `--scan-dir` flags:
58+
59+
```bash
60+
messenger-docs --scan-dir app --scan-dir shared --serve
61+
```
62+
63+
### CLI options
64+
65+
```
66+
messenger-docs [project-path] [options]
3067
31-
# Scan source .ts files instead of .d.cts (for monorepo development)
32-
npx @metamask/messenger-docs --source
68+
Arguments:
69+
project-path Path to the project to scan (default: current directory)
3370
34-
# Custom output directory (default: .messenger-docs)
35-
npx @metamask/messenger-docs --output ./my-docs
71+
Options:
72+
--build Generate docs and build static site
73+
--serve Generate docs, build, and serve static site
74+
--dev Generate docs and start dev server with hot reload
75+
--scan-dir <dir> Extra source directory to scan (repeatable)
76+
--output <dir> Output directory (default: <project-path>/.messenger-docs)
77+
--help Show this help message
3678
```
3779

3880
## Contributing

0 commit comments

Comments
 (0)