Skip to content

Commit

Permalink
Merge branch 'main' into 231201-fix-accounts-controller-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
MajorLift committed Dec 7, 2023
2 parents d3d7219 + aca89a4 commit 4f99106
Show file tree
Hide file tree
Showing 61 changed files with 4,155 additions and 1,164 deletions.
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ This monorepo is a collection of packages used across multiple MetaMask clients

## Modules

This repository houses the following packages:
This repository contains the following packages [^fn1]:

<!-- start package list -->

- [`@metamask/accounts-controller`](packages/accounts-controller)
- [`@metamask/address-book-controller`](packages/address-book-controller)
- [`@metamask/announcement-controller`](packages/announcement-controller)
- [`@metamask/approval-controller`](packages/approval-controller)
- [`@metamask/assets-controllers`](packages/assets-controllers)
- [`@metamask/base-controller`](packages/base-controller)
- [`@metamask/build-utils`](packages/build-utils)
- [`@metamask/composable-controller`](packages/composable-controller)
- [`@metamask/controller-utils`](packages/controller-utils)
- [`@metamask/ens-controller`](packages/ens-controller)
Expand All @@ -20,21 +23,23 @@ This repository houses the following packages:
- [`@metamask/json-rpc-engine`](packages/json-rpc-engine)
- [`@metamask/json-rpc-middleware-stream`](packages/json-rpc-middleware-stream)
- [`@metamask/keyring-controller`](packages/keyring-controller)
- [`@metamask/logging-controller`](packages/logging-controller);
- [`@metamask/logging-controller`](packages/logging-controller)
- [`@metamask/message-manager`](packages/message-manager)
- [`@metamask/name-controller`](packages/name-controller)
- [`@metamask/network-controller`](packages/network-controller)
- [`@metamask/notification-controller`](packages/notification-controller)
- [`@metamask/permission-controller`](packages/permission-controller)
- [`@metamask/permission-log-controller`](packages/permission-log-controller)
- [`@metamask/phishing-controller`](packages/phishing-controller)
- [`@metamask/polling-controller`](packages/polling-controller)
- [`@metamask/preferences-controller`](packages/preferences-controller)
- [`@metamask/queued-request-controller`](packages/queued-request-controller)
- [`@metamask/rate-limit-controller`](packages/rate-limit-controller)
- [`@metamask/selected-network-controller`](packages/selected-network-controller);
- [`@metamask/selected-network-controller`](packages/selected-network-controller)
- [`@metamask/signature-controller`](packages/signature-controller)
- [`@metamask/transaction-controller`](packages/transaction-controller)
- [`@metamask/permission-log-controller`](packages/permission-log-controller)

<!-- end package list -->

Or, in graph form [^fn1]:

Expand Down Expand Up @@ -122,12 +127,12 @@ linkStyle default opacity:0.5
polling_controller --> network_controller;
preferences_controller --> base_controller;
preferences_controller --> controller_utils;
queued_request_controller --> approval_controller;
queued_request_controller --> base_controller;
queued_request_controller --> controller_utils;
queued_request_controller --> json_rpc_engine;
queued_request_controller --> network_controller;
queued_request_controller --> selected_network_controller;
queued_request_controller --> approval_controller;
rate_limit_controller --> base_controller;
selected_network_controller --> base_controller;
selected_network_controller --> json_rpc_engine;
Expand All @@ -153,4 +158,4 @@ Refer to individual packages for usage instructions.

For instructions on performing common development-related tasks, see [contributing to the monorepo](./docs/contributing.md).

[^fn1]: This graph can be auto-generated! To update it based on the current set of packages, run `yarn generate-dependency-graph`.
[^fn1]: The package list and dependency graph should be programmatically generated by running `yarn update-readme-content`.
53 changes: 40 additions & 13 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,28 +163,32 @@ To use a preview build for a package within a project, you need to override the

The [`create-release-branch`](https://github.com/MetaMask/create-release-branch) tool and [`action-publish-release`](https://github.com/MetaMask/action-publish-release) GitHub action are used to automate the release process.

1. **Create a release branch.**
1. **Initiate the release branch and specify packages to be released.**

Run `yarn create-release-branch`. This tool generates a file and opens it in your editor, where you can specify which packages you want to include in the next release and which versions they should receive. Instructions are provided for you at the top; read them and update the file accordingly.
1. **Create the release branch.**

When you're ready to continue, save and close the file.
Start by running `yarn create-release-branch`. This command creates a branch named `release/<new release version>` which will represent the new release.

2. **Update changelogs for relevant packages.**
2. **Specify packages to release along with their versions.**

At this point you will be on a new release branch, and a new section will have been added to the changelog of each package you specified in the previous step.
At this point, you need to tell the tool which packages you want to include in the next release and which versions to assign to those packages. You do this by modifying a YAML file called a "release spec", which the tool has generated and opened it in your editor. Follow the instructions at the top of the file to proceed.

For each changelog, review the new section and make the appropriate changes:
To assist you, the tool has also updated all of the packages that have been changed since their previous releases so that their changelogs now reflect those new changes. This should help you to understand what will be released and how to bump the versions.

- Move each entry into the appropriate category (review the ["Keep a Changelog"](https://keepachangelog.com/en/1.0.0/#types) spec for the full list of categories and the correct ordering of all categories).
- Remove any changelog entries that don't affect consumers of the package (e.g. lockfile changes or development environment changes). Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.).
- Reword changelog entries to explain changes in terms that users of the package will understand (e.g., avoid referencing internal variables/concepts).
- Consolidate related changes into one change entry if it makes it easier to comprehend.
Once you save and close the release spec, the tool will proceed.

Run `yarn changelog:validate` to check that all changelogs are correctly formatted.
2. **Review and update changelogs for relevant packages.**

Commit and push the branch.
1. At this point, the versions of all packages you intend to release have been bumped and their changelogs list new changes. Now you need to go through each changelog and make sure that they follow existing standards:

3. **Submit a pull request for the release branch so that it can be reviewed and tested.**
- Categorize entries appropriately following the ["Keep a Changelog"](https://keepachangelog.com/en/1.0.0/) guidelines.
- Remove changelog entries that don't affect consumers of the package (e.g. lockfile changes or development environment changes). Exceptions may be made for changes that might be of interest despite not having an effect upon the published package (e.g. major test improvements, security improvements, improved documentation, etc.).
- Reword changelog entries to explain changes in terms that users of the package will understand (e.g., avoid referencing internal variables/concepts).
- Consolidate related changes into single entries where appropriate.

2. Run `yarn changelog:validate` to ensure all changelogs are correctly formatted.

3. **Push and submit a pull request for the release branch so that it can be reviewed and tested.**

Make sure the title of the pull request follows the pattern "Release \<new version\>".

Expand All @@ -201,3 +205,26 @@ The [`create-release-branch`](https://github.com/MetaMask/create-release-branch)
The `publish-release` GitHub Action workflow runs the `publish-npm` job, which publishes relevant packages to NPM. It requires approval from the [`npm-publishers`](https://github.com/orgs/MetaMask/teams/npm-publishers) team to complete. If you're not on the team, ask a member to approve it for you; otherwise, approve the job.

Once the `publish-npm` job has finished, [check NPM](https://npms.io/search?q=scope%3Ametamask) to verify that all relevant packages has been published.

### Handling common errors

If an error occurs, re-edit the release spec and rerun `yarn create-release-branch`. Common errors include:

- **Invalid Version Specifier:**

- Error: `* Line 14: "invalid_version" is not a valid version specifier...`
- Resolution: Use "major", "minor", "patch", or a specific version number like "1.2.3".

- **Version Less than or Equal to Current:**

- Error: `* Line 14: "1.2.3" is not a valid version specifier...`
- Resolution: Specify a version greater than the current version of the package.

- **Releasing Packages with Breaking Changes:**

- Error: `* The following dependents of package '@metamask/a'...`
- Resolution: Include dependent packages in the release or use "intentionally-skip" if certain they are unaffected.

- **Dependencies/Peer Dependencies Missing:**
- Error: `* The following packages, which are dependencies...`
- Resolution: Include necessary dependencies or peer dependencies in the release or use "intentionally-skip" if certain they are unaffected.
2 changes: 1 addition & 1 deletion docs/package-migration-process-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ This library has now been migrated into the [core monorepo](https://github.com/m

### Core

1. **[PR#15]** Add migration target to the list of packages in the README as well as the dependency graph in the README (the latter can be updated automatically by running `yarn generate-dependency-graph`).
1. **[PR#15]** Add migration target to the list of packages in the README as well as the dependency graph in the README by running `yarn update-readme-content`.
2. Fix downstream errors that were marked with `@ts-expect-error TODO:` during the migration process.

- If possible, perform this step before the first post-migration release of the migrated package.
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
"build:watch": "yarn run build --watch",
"changelog:validate": "yarn workspaces foreach --parallel --interlaced --verbose run changelog:validate",
"child-workspace-package-names-as-json": "ts-node scripts/child-workspace-package-names-as-json.ts",
"generate-dependency-graph": "ts-node scripts/generate-dependency-graph.ts",
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn constraints",
"lint:eslint": "eslint . --cache --ext js,ts",
"lint:fix": "yarn lint:eslint --fix && yarn constraints --fix && yarn lint:misc --write && yarn",
Expand All @@ -29,7 +28,8 @@
"setup": "yarn install",
"test": "yarn test:verbose --silent --collectCoverage=false --reporters=jest-silent-reporter",
"test:clean": "yarn workspaces foreach --parallel --verbose run test:clean && yarn test",
"test:verbose": "yarn workspaces foreach --parallel --verbose run test:verbose"
"test:verbose": "yarn workspaces foreach --parallel --verbose run test:verbose",
"update-readme-content": "ts-node scripts/update-readme-content.ts"
},
"simple-git-hooks": {
"pre-push": "yarn lint"
Expand All @@ -39,7 +39,7 @@
},
"devDependencies": {
"@lavamoat/allow-scripts": "^2.3.1",
"@metamask/create-release-branch": "^1.1.0",
"@metamask/create-release-branch": "^2.0.1",
"@metamask/eslint-config": "^12.2.0",
"@metamask/eslint-config-jest": "^12.1.0",
"@metamask/eslint-config-nodejs": "^12.1.0",
Expand Down
21 changes: 21 additions & 0 deletions packages/assets-controllers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
### Added
- Add `codefiTokenPricesServiceV2` ([#3600](https://github.com/MetaMask/core/pull/3600))
- This object can be used for the new `tokenPricesService` argument for TokenRatesController. It uses an internal API to fetch prices for tokens instead of CoinGecko.

### Changed
- **BREAKING:** TokenRatesController now takes a required argument `tokenPricesService` ([#3600](https://github.com/MetaMask/core/pull/3600))
- This object is responsible for fetching the prices for tokens held by this controller.
- **BREAKING:** Update signature of `TokenRatesController.updateExchangeRatesByChainId` ([#3600](https://github.com/MetaMask/core/pull/3600))
- Rename `tokenAddresses` argument to `tokenContractAddresses`
- Change the type of `tokenContractAddresses` from `string[]` to `Hex[]`
- **BREAKING:** Change signature of `TokenRatesController.fetchAndMapExchangeRates` ([#3600](https://github.com/MetaMask/core/pull/3600))
- This method now takes an object with shape `{ tokenContractAddresses: Hex[]; chainId: Hex; nativeCurrency: string; }` rather than positional arguments
- Update TokenListController to fetch prefiltered set of tokens from the API, reducing response data and removing the need for filtering logic ([#2054](https://github.com/MetaMask/core/pull/2054))

### Removed
- **BREAKING:** Remove `fetchExchangeRate` method from TokenRatesController ([#3600](https://github.com/MetaMask/core/pull/3600))
- This method (not to be confused with `updateExchangeRate`, which is still present) was only ever intended to be used internally and should not be accessed directly.
- **BREAKING:** Remove `getChainSlug` method from TokenRatesController ([#3600](https://github.com/MetaMask/core/pull/3600))
- This method was previously used in TokenRatesController to access the CoinGecko API. There is no equivalent.
- **BREAKING:** Remove `CoinGeckoResponse` and `CoinGeckoPlatform` types ([#3600](https://github.com/MetaMask/core/pull/3600))
- These types were previously used in TokenRatesController to represent data returned from the CoinGecko API. There is no equivalent.

## [20.0.0]
### Added
Expand Down
2 changes: 1 addition & 1 deletion packages/assets-controllers/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ module.exports = merge(baseConfig, {
coverageThreshold: {
global: {
branches: 88.2,
functions: 96,
functions: 95.95,
lines: 96.25,
statements: 96.5,
},
Expand Down
Loading

0 comments on commit 4f99106

Please sign in to comment.