Skip to content

Commit 701d482

Browse files
committed
Reorganize contributor docs
Most of the contributor docs are kept in one main file, but as time as gone on we have split out specific topics into their own files. Some files are not linked from the main file at all. Finally, one of the files in `docs/` is intended for the `core-backend` repo, not the repo as a whole. Ultimately, this is confusing for contributors. This commit converts the main file to a table of contents, organized by category, and makes sure to link to every file in `docs/`. It also moves the `core-backend`-specific file to that package.
1 parent aaa5ecb commit 701d482

25 files changed

+413
-673
lines changed

.github/pull_request_template.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ For example:
2727

2828
- [ ] I've updated the test suite for new or updated code as appropriate
2929
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
30-
- [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs)
31-
- [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them
30+
- [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/processes/updating-changelogs.md)
31+
- [ ] I've introduced [breaking changes](https://github.com/MetaMask/core/tree/main/docs/processes/breaking-changes.md) in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This monorepo is a collection of packages used across multiple MetaMask clients
44

55
## Contributing
66

7-
See the [Contributor Guide](./docs/contributing.md) for help on:
7+
See the [Contributor Guide](./docs) for help on:
88

99
- Setting up your development environment
1010
- Working with the monorepo

docs/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Contributor Guide
2+
3+
Hi! Welcome to the contributor documentation for the `core` monorepo.
4+
5+
## Getting started
6+
7+
- [Setting up your development environment](./getting-started/setting-up-your-environment.md)
8+
- [Codeownership](./getting-started/codeownership.md)
9+
- [Code guidelines for this repo](#code-guidelines)
10+
11+
## Processes
12+
13+
- [Performing operations across the monorepo](./processes/general-monorepo-operations.md)
14+
- [Writing and running tests](./processes/testing.md)
15+
- [Linting and formatting](./processes/linting-and-formatting.md)
16+
- [Updating changelogs](./processes/updating-changelogs.md)
17+
- [Creating pull requests](./processes/creating-pull-requests.md)
18+
- [Releasing changes](./processes/releasing.md)
19+
- [Preparing and releasing breaking changes](./processes/breaking-changes.md)
20+
- [Reviewing release PRs](./processes/reviewing-release-prs.md)
21+
- [Testing changes to packages in other projects](./processes/testing-changes-in-other-projects.md)
22+
- [Building packages](./processes/building.md)
23+
- [Adding new packages to the monorepo](./processes/adding-new-packages.md)
24+
- [Migrating external packages to the monorepo](./processes/package-migration-process-guide.md)
25+
- [Migrating tags](./processes/migrate-tags.md)
26+
27+
## Code guidelines
28+
29+
- [General MetaMask code guidelines](https://github.com/MetaMask/contributor-docs)
30+
- [General guidelines for all packages](./code-guidelines/package-guidelines.md)
31+
- [Writing controllers](./code-guidelines/controller-guidelines.md)
32+
- [Writing data services](./code-guidelines/data-services.md)

docs/controller-guidelines.md renamed to docs/code-guidelines/controller-guidelines.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Guidelines for Writing Controllers
1+
# Guidelines for writing controllers
22

33
## Understand the purpose of the controller pattern
44

@@ -64,7 +64,7 @@ class FooController extends BaseController</* ... */> {
6464

6565
## Provide a default representation of state
6666

67-
Each controller needs a default representation in order to fully initialize itself when [receiving a partial representation of state](#accept-a-partial-representation-of-state). A default representation of state is also useful when testing interactions with a controller's `*:stateChange` event.
67+
Each controller needs a default representation in order to fully initialize itself when [receiving a partial representation of state](#accept-an-optional-partial-representation-of-state). A default representation of state is also useful when testing interactions with a controller's `*:stateChange` event.
6868

6969
A function which returns this default representation should be defined and exported. It should be called `getDefault${ControllerName}State`.
7070

@@ -637,7 +637,7 @@ export type FooControllerMessenger = Messenger<
637637
>;
638638
```
639639

640-
If, in a test, you need to access all of the actions supported by a messenger, use the [`MessengerActions` utility type](../packages/messenger/src/Messenger.ts):
640+
If, in a test, you need to access all of the actions supported by a messenger, use the [`MessengerActions` utility type](../../packages/messenger/src/Messenger.ts):
641641

642642
```typescript
643643
import type { MessengerActions, MessengerEvents } from '@metamask/messenger';
@@ -716,7 +716,7 @@ export type FooControllerMessenger = Messenger<
716716
>;
717717
```
718718

719-
If, in a test, you need to access all of the events supported by a messenger, use the [`MessengerEvents` utility type](../packages/messenger/src/Messenger.ts):
719+
If, in a test, you need to access all of the events supported by a messenger, use the [`MessengerEvents` utility type](../../packages/messenger/src/Messenger.ts):
720720

721721
```typescript
722722
import type { MessengerActions, MessengerEvents } from '@metamask/messenger';
@@ -1432,7 +1432,7 @@ export const selectActiveAccounts = createSelector(
14321432

14331433
## Treat state-mutating methods as actions
14341434

1435-
Just as each property of state [does not require a getter method to be accessed](#remove-getters-in-favor-of-direct-state-access), each property of state does not require a setter method to be updated, either.
1435+
Just as each property of state [does not require a getter method to be accessed](#expose-derived-state-using-selectors-instead-of-getters), each property of state does not require a setter method to be updated, either.
14361436

14371437
Methods that change the state of the controller do not need to represent granular, low-level operations such as adding, updating, or deleting a single property from state. Rather, they should be designed to support a higher-level task that the consumer wants to carry out. This is ultimately dictated by the needs of the client UI, and so they should also be given a name that reflects the behavior in the UI.
14381438

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Data Services
1+
# Data services
22

33
## What is a data service?
44

@@ -480,4 +480,4 @@ class SendController extends BaseController {
480480
481481
## Learning more
482482
483-
The [`sample-controllers`](../packages/sample-controllers) package has a full example of the data service pattern. including JSDoc for all types, classes, and methods. Check it out and feel free to copy and paste the code you see to your own project.
483+
The [`sample-controllers`](../../packages/sample-controllers) package has a full example of the data service pattern. including JSDoc for all types, classes, and methods. Check it out and feel free to copy and paste the code you see to your own project.

docs/package-guidelines.md renamed to docs/code-guidelines/package-guidelines.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Guidelines for Packages
1+
# Guidelines for packages
22

33
## List exports explicitly
44

0 commit comments

Comments
 (0)