You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With these changes, you can post a comment in a PR with the content
`@metamaskbot publish-preview`, and it will build the branch and publish
it under the `@metamask-previews` under a special version. This works
very similarly to how it works in `core`.
Copy file name to clipboardExpand all lines: README.md
+39-4Lines changed: 39 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,10 +25,6 @@ Run `yarn test` to run the tests once. To run tests on file changes, run `yarn t
25
25
26
26
Run `yarn lint` to run the linter, or run `yarn lint:fix` to run the linter and fix any automatically fixable issues.
27
27
28
-
### Linking
29
-
30
-
First, `yarn build:link` in this repository, then link it by running `yarn link` in the consumer repository.
31
-
32
28
### Release & Publishing
33
29
34
30
The project follows the same release process as the other libraries in the MetaMask organization. The GitHub Actions [`action-create-release-pr`](https://github.com/MetaMask/action-create-release-pr) and [`action-publish-release`](https://github.com/MetaMask/action-publish-release) are used to automate the release process; see those repositories for more information about how they work.
@@ -66,3 +62,42 @@ The project follows the same release process as the other libraries in the MetaM
66
62
- Wait for the `publish-release` GitHub Action workflow to finish. This should trigger a second job (`publish-npm`), which will wait for a run approval by the [`npm publishers`](https://github.com/orgs/MetaMask/teams/npm-publishers) team.
67
63
- Approve the `publish-npm` job (or ask somebody on the npm publishers team to approve it for you).
68
64
- Once the `publish-npm` job has finished, check npm to verify that it has been published.
65
+
66
+
### Testing changes in other projects using preview builds
67
+
68
+
If you are working on a pull request and want to test changes in another project before you publish them, you can create a _preview build_ and then configure your project to use it.
69
+
70
+
#### Creating a preview build
71
+
72
+
1. Within your pull request, post a comment with the text `@metamaskbot publish-preview`. This starts the `publish-preview` GitHub action, which will create a preview build and publish it to NPM.
73
+
2. After a few minutes, the action should complete and you will see a new comment. Note two things:
74
+
- The name is scoped to `@metamask-previews` instead of `@metamask`.
75
+
- The ID of the last commit in the branch is appended to the version, e.g. `1.2.3-preview-e2df9b4` instead of `1.2.3`.
76
+
77
+
#### Using a preview build
78
+
79
+
To use a preview build within a project, you need to override the resolution logic for your package manager so that the "production" version of that package is replaced with the preview version. Here's how you do that:
80
+
81
+
1. Open `package.json` in the project and locate the entry for this package in `dependencies`.
82
+
2. Locate the section responsible for resolution overrides (or create it if it doesn't exist). If you're using Yarn, this is `resolutions`; if you're using NPM or any other package manager, this is `overrides`.
83
+
3. Add a line to this section that mirrors the dependency entry on the left-hand side and points to the preview version on the right-hand side. Note the exact format of the left-hand side will differ based on which version of Yarn or NPM you are using. For example:
84
+
- For Yarn Modern, you will add something like this to `resolutions`:
A preview build for this branch has been published.
12
+
13
+
You can configure your project to use the preview build with this identifier:
14
+
15
+
npm:${package_name}@${package_version}
16
+
17
+
[See these instructions](https://github.com/MetaMask/smart-transactions-controller/blob/main/README.md#testing-changes-in-other-projects-using-preview-builds) for more information about preview builds.\
0 commit comments