Skip to content

Commit fee1554

Browse files
Update spec preview instructions (#1984)
* Update spec preview instructions * update intro sentence
1 parent 73aa2b6 commit fee1554

File tree

1 file changed

+28
-29
lines changed

1 file changed

+28
-29
lines changed

CONTRIBUTING.md

+28-29
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@ Additionally, follow the [Consensys guidelines on adding images](https://docs-te
129129

130130
## Update the interactive API reference
131131

132-
The [Wallet JSON-RPC API reference](https://docs.metamask.io/wallet/reference/json-rpc-api/) uses the
133-
[`docusaurus-openrpc`](https://github.com/MetaMask/docusaurus-openrpc) plugin to import OpenRPC
132+
The [Wallet JSON-RPC API reference](https://docs.metamask.io/wallet/reference/json-rpc-api/) uses
133+
an internal plugin to import and parse OpenRPC
134134
specifications from [`MetaMask/api-specs`](https://github.com/MetaMask/api-specs) (MetaMask-specific
135135
methods) and [`ethereum/execution-apis`](https://github.com/ethereum/execution-apis) (standard
136136
Ethereum methods).
@@ -152,17 +152,33 @@ To update documentation for MetaMask-specific JSON-RPC API methods:
152152
2. Follow the repository's [`README.md`](https://github.com/MetaMask/api-specs/blob/main/README.md)
153153
instructions to edit the OpenRPC specification and generate the output file, `openrpc.json`.
154154

155-
3. To test the API updates in the MetaMask doc site's interactive reference, make the following
156-
temporary changes on a local branch of the doc site, `metamask-docs`:
155+
3. To test the API updates in the MetaMask doc site's interactive reference:
157156

158-
1. Copy and paste the output file `openrpc.json` into the root directory of `metamask-docs`.
159-
2. In `docusaurus.config.js`, update the following line to point to your local output file:
157+
1. Create and switch to a temporary local branch of the doc site, [`MetaMask/metamask-docs`](https://github.com/MetaMask/metamask-docs).
158+
For example, to create and switch to a branch named `test-api-updates`:
159+
```bash
160+
cd metamask-docs
161+
git checkout -b test-api-updates
162+
```
163+
2. Copy and paste the output file `openrpc.json` into the root directory of `metamask-docs`.
164+
3. Use [`http-server`](https://www.npmjs.com/package/http-server) to serve `openrpc.json` locally.
165+
Install `http-server` if you haven't yet, and start the server:
166+
```bash
167+
npm install --global http-server
168+
http-server
169+
```
170+
The `openrpc.json` file is now served at [`http://127.0.0.1:8080/openrpc.json`](http://127.0.0.1:8080/openrpc.json).
171+
4. In `src/plugins/plugin-json-rpc.ts`, update the following line to point to the locally served `openrpc.json` file:
160172
```diff
161-
openrpcDocument:
162-
- "https://metamask.github.io/api-specs/0.10.5/openrpc.json",
163-
+ "./openrpc.json",
173+
- export const MM_RPC_URL = "https://metamask.github.io/api-specs/latest/openrpc.json";
174+
+ export const MM_RPC_URL = "http://127.0.0.1:8080/openrpc.json";
175+
```
176+
5. In a new terminal window, preview the doc site locally:
177+
```bash
178+
cd metamask-docs
179+
npm start
164180
```
165-
3. Preview the doc site locally, navigate to the API reference, and view your updates.
181+
6. Navigate to the API reference, and view your updates.
166182
167183
4. Add and commit your changes to `api-specs`, and create a PR.
168184
@@ -180,14 +196,6 @@ To update documentation for MetaMask-specific JSON-RPC API methods:
180196
For example:
181197
> @metamask-npm-publishers `@metamask/[email protected]` is awaiting deployment :rocketship:
182198
https://github.com/MetaMask/api-specs/actions/runs/10615788573
183-
3. Once the release is published on npm, `docusaurus.config.js` in `metamask-docs` must be
184-
updated with the new `api-specs` version to publish.
185-
For example:
186-
```diff
187-
openrpcDocument:
188-
- "https://metamask.github.io/api-specs/0.10.5/openrpc.json",
189-
+ "https://metamask.github.io/api-specs/0.10.6/openrpc.json",
190-
```
191199
192200
### Update `ethereum/execution-apis`
193201
@@ -204,17 +212,8 @@ To update documentation for standard Ethereum JSON-RPC API methods:
204212
2. Follow the repository's [`README.md`](https://github.com/ethereum/execution-apis/blob/main/README.md)
205213
instructions to edit the OpenRPC specification and generate the output file, `openrpc.json`.
206214

207-
3. To test the API updates in the MetaMask doc site's interactive reference, make the following
208-
temporary changes on a local branch of the doc site, `metamask-docs`:
209-
210-
1. Copy and paste the output file `openrpc.json` into the root directory of `metamask-docs`.
211-
2. In `docusaurus.config.js`, update the following line to point to your local output file:
212-
```diff
213-
openrpcDocument:
214-
- "https://metamask.github.io/api-specs/0.10.5/openrpc.json",
215-
+ "./openrpc.json",
216-
```
217-
3. Preview the doc site locally, navigate to the API reference, and view your updates.
215+
3. To test the API updates in the MetaMask doc site's interactive reference, complete Step 3 in
216+
[Update `MetaMask/api-specs`](#update-metamaskapi-specs).
218217
219218
4. Add and commit your changes to `execution-apis`, and create a PR.
220219

0 commit comments

Comments
 (0)