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
When we added preview builds to some polyrepos, we copied the workflow
from this repo and made some improvements at the same time. This commit
applies those same improvements.
- Add emoji reaction to preview build request comment when workflow
begins.
- Simplify preview build docs by removing external contributor-specific
instructions.
- Remove package scripts from root and workspace packages. The scripts
used by the preview build workflow aren't meant to be called
explicitly, and in fact may be dangerous to do so. This also makes the
workflow more copy-and-pasteable to other projects.
- Convert script to generate reply comment to bash.
- Simplify output in reply comment, and fix link to docs.
Copy file name to clipboardExpand all lines: docs/contributing.md
+26-52Lines changed: 26 additions & 52 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -129,70 +129,44 @@ If you're developing your project locally and want to test changes to a package,
129
129
130
130
3. Due to the use of Yarn's `file:` protocol, if you update the package in the monorepo, then you'll need to run `yarn install` in the project again.
131
131
132
-
### Testing changes to packages with preview builds
132
+
## Testing changes against other projects using preview builds
133
133
134
-
If you want to test changes to a package where it would be unwieldy or impossible to use a local version, such as on CI, you can publish a preview build and configure your project to use it.
134
+
If you are working on a pull request and want to test changes to one or more packages in another project before you publish them, you can create _preview builds_ and then configure your project to use them.
135
135
136
-
#### Publishing preview builds as a MetaMask contributor
137
-
138
-
If you're a member of the MetaMask organization, you can create preview builds based on a pull request by following these steps:
139
-
140
-
1. Post a comment on the pull request with the text `@metamaskbot publish-preview`. This starts the `publish-preview` GitHub action, which will create preview builds for all packages in the monorepo.
141
-
2. After a few minutes, the action should complete and you will see a new comment that lists the newly published packages along with their versions.
142
-
143
-
Note two things about each package:
136
+
### Creating preview builds
144
137
138
+
1. Within your pull request, post a comment with the text `@metamaskbot publish-preview`. This starts the `publish-preview` GitHub action, which will build all of the packages as they exist on the branch and publish them to NPM under a special namespace.
139
+
2. After a few minutes, the action should complete and you will see a new comment. Note two things:
145
140
- The name is scoped to `@metamask-previews` instead of `@metamask`.
146
141
- 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`.
147
142
148
-
Now you can [use these preview builds in your project](#using-preview-builds).
149
-
150
-
If you make more changes to a package, follow step 2 again, making sure to update the reference to the package in your project's `package.json` to use the newly published preview version.
151
-
152
-
#### Publishing preview builds as an independent contributor
153
-
154
-
If you've forked this repository, you can create preview builds based on a branch by following these steps:
155
-
156
-
1. First, since an NPM scope is used to host preview build releases, you'll need access to one. If you do not, you can either [create a new organization](https://www.npmjs.com/org/create) or [convert your existing username into an organization](https://www.npmjs.com/org/upgrade).
157
-
158
-
2. Once you've done this, open the `package.json` for each package that you want to publish and change the scope in the name from `@metamask` to `@<NPM_ORG>`, replacing `NPM_ORG` with your NPM organization.
159
-
160
-
3. Next, run the following command to create and publish the preview builds (again, replacing `NPM_ORG` as appropriate):
You should be able to see the published version of each package in the output. Note two things:
167
-
168
-
- The name is scoped to the NPM organization you entered instead of `@metamask`.
169
-
- 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`.
170
-
171
-
Now you can [use these preview builds in your project](#using-preview-builds).
172
-
173
-
If you make more changes to a package, follow step 3 again, making sure to update the reference to the package in your project's `package.json` to use the newly published preview version.
143
+
### Using preview builds
174
144
175
-
#### Using preview builds
145
+
To use preview builds 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:
176
146
177
-
To use a preview build for a package 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:
178
-
179
-
1. Open `package.json` in the project and locate the dependency entry for the core package for which you want to use a preview build.
147
+
1. Open `package.json` in the project and locate the entry for this package in `dependencies`.
180
148
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`.
181
-
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:
149
+
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:
150
+
- For Yarn Modern, you will add something like this to `resolutions`:
> - If your project uses Yarn, `@metamask/controller-utils` is listed in dependencies at `^1.1.4`, and you want to use the preview version `1.2.3-preview-e2df9b4`, add the following to `resolutions`:
0 commit comments