Skip to content

Commit 0432905

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 0432905

22 files changed

+404
-664
lines changed

.github/pull_request_template.md

Lines changed: 1 addition & 1 deletion
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)
30+
- [ ] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/updating-changelogs.md)
3131
- [ ] 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

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: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

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

docs/contributing.md

Lines changed: 0 additions & 401 deletions
This file was deleted.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Understanding codeowners
2+
3+
Although maintenance of this repository is superintended by the Wallet Framework team, the responsibility of maintenance is expected to be shared among multiple teams at MetaMask. In fact, some teams have codeownership over specific packages. The exact allocation is governed by the [`CODEOWNERS`](../.github/CODEOWNERS) file.
4+
5+
**If your team is listed as a codeowner for a package, you may change, approve pull requests, and create releases without consulting the Wallet Framework team.** Alternatively, if you feel that your team should be granted codeownership over a specific package, you can submit a pull request to change `CODEOWNERS`.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Setting up your development environment
2+
3+
1. Install the current LTS version of [Node](https://nodejs.org).
4+
- If you are using [NVM](https://github.com/creationix/nvm#installation) (recommended), running `nvm install` will install the latest version, and running `nvm use` will automatically choose the right Node version for you.
5+
2. Run `corepack enable` to install [Yarn](https://yarnpkg.com) via [Corepack](https://github.com/nodejs/corepack?tab=readme-ov-file#how-to-install).
6+
- If you have Yarn installed globally via Homebrew or NPM, you'll need to uninstall it before running this command.
7+
3. Run `yarn install` to install dependencies and run any required post-install scripts.
8+
4. Run `yarn simple-git-hooks` to add a [Git hook](https://github.com/toplenboren/simple-git-hooks#what-is-a-git-hook) to your local development environment which will ensure that all files pass linting before you push a branch.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Adding new Packages to the monorepo
2+
3+
> [!NOTE]
4+
> If you're migrating an existing package to the monorepo, please see [the package migration documentation](./package-migration-process-guide.md). You may be able to make use of `create-package` when migrating your package, but there's a lot more to it.
5+
6+
Manually creating a new monorepo package can be a tedious, even frustrating process. To alleviate that problem, we have created a CLI that automates most of the job for us, creatively titled [`create-package`](../scripts/create-package/). To create a new monorepo package, follow these steps:
7+
8+
1. Create a new package using `yarn create-package`.
9+
- Use the `--help` flag for usage information.
10+
- Once this is done, you can find a package with your chosen name in `/packages`.
11+
2. Make sure your license is correct.
12+
- By default, `create-package` gives your package an MIT license.
13+
- If your desired license is _not_ MIT, then you must update your `LICENSE` file and the `license` field of `package.json`.
14+
3. Update `.github/CODEOWNERS` and `teams.json` to assign a team as the owner of the new package.
15+
4. Add your dependencies.
16+
- Do this as normal using `yarn`.
17+
- Remember, if you are adding other monorepo packages as dependents, don't forget to add them to the `references` array in your package's `tsconfig.json` and `tsconfig.build.json`.
18+
19+
And that's it!
20+
21+
### Contributing to `create-package`
22+
23+
Along with this documentation, `create-package` is intended to be the source of truth for the process of adding new packages to the monorepo. Consequently, to change that process, you will want to change `create-package`.
24+
25+
The `create-package` directory contains a [template package](../scripts/create-package/package-template/). The CLI is not aware of the contents of the template, only that its files have [placeholder values](../scripts/create-package/constants.ts). When a new package is created, the template files are read from disk, the placeholder values are replaced with real ones, and the updated files are added to a new directory in `/packages`. To modify the template package:
26+
27+
- If you need to add or modify any files or folders, just go ahead and make your changes in [`/scripts/create-package/package-template`](../scripts/create-package/package-template/). The CLI will read whatever's in that directory and write it to disk.
28+
- If you need to add or modify any placeholders, make sure that your desired values are added to both the relevant file(s) and [`/scripts/create-package/constants.ts`](../scripts/create-package/constants.ts). Then, update the implementation of the CLI accordingly.
29+
- As with placeholders, updating the monorepo files that the CLI interacts with begins by updating [`/scripts/create-package/constants.ts`](../scripts/create-package/constants.ts).
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Preparing & Releasing Breaking Changes
1+
# Preparing and releasing breaking changes
22

33
When developing packages, it is always important to be intentional about the impact that changes have on projects which use those packages. However, special consideration must be given to breaking changes.
44

@@ -73,7 +73,7 @@ For dependent packages located in `core`, you may get type errors immediately th
7373

7474
For other projects that live outside of `core`, you can use the following process to verify the effects:
7575

76-
1. Create a [preview build](./contributing.md#testing-changes-to-packages-with-preview-builds) for your package.
76+
1. Create a [preview build](./testing-changes-in-other-projects.md#testing-changes-to-packages-with-preview-builds) for your package.
7777
2. Open draft PRs in the dependent projects.
7878
3. In each draft PR, upgrade your package to the preview build.
7979
4. Test the project, particularly the functionality that makes use of your package.

0 commit comments

Comments
 (0)