Skip to content

Commit 1e4a0f1

Browse files
feat(docs): Add a contributing and release guide (#2625)
## Summary: Add a Contributiong and Release guide to the website, so that the knowledge of how to do releases is public. --------- Co-authored-by: Adam Gleitman <[email protected]>
1 parent b4b142a commit 1e4a0f1

File tree

12 files changed

+118
-217
lines changed

12 files changed

+118
-217
lines changed

docs_archive/Releases.md

Lines changed: 0 additions & 217 deletions
This file was deleted.
-228 KB
Binary file not shown.
-98.5 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"label": "Contributing",
3+
"position": 4,
4+
"link": { "type": "generated-index", "description": "Contribution guidelines for react-native-macos" },
5+
"collapsed": false
6+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
sidebar_label: 'Overview'
3+
sidebar_position: 1
4+
---
5+
6+
# Contributing
7+
8+
Thank you for your interest in contributing to React Native! Feel free to file or issues or open PRs into React Native macOS.
9+
10+
Because React Native macOS is a fork of React Native, we follow some rules to keep our commit history happy and our diffs with upstream manageable. The rest of this guide will focus on explaining our diffs, along with a guide for how to drive a release for those working on the repo.

docs_archive/DiffsWithUpstream.md renamed to docsite/docs/contributing/diffs-with-upstream.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
sidebar_label: 'macOS Tags'
3+
sidebar_position: 2
4+
---
5+
16
# How React Native macOS differs from React Native
27

38
React Native macOS elected to implement our fork via inline diffs of existing React Native code. This means additions and changes of extra code to support macOS, usually in the same file as the existing iOS or JS implementation.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
sidebar_label: 'Versioning'
3+
sidebar_position: 3
4+
---
5+
6+
# Versioning
7+
8+
React Native macOS uses [NX Release](https://nx.dev/features/manage-releases) to control its versioning. Our minor releases are synced to upstream releases of React Native, but our patch versions may differ. For instance, `[email protected]` corresponds to `[email protected]`. You can find out how we sync our releases by looking at our packages' [react-native peer dependency](https://github.com/microsoft/react-native-macos/blob/8f8fd013d2a36cf2635dbcef76970119f7672b51/packages/react-native/package.json#L105).
9+
10+
## How to push a new patch release
11+
12+
If you have a PR you'd like to be included in a new release, you can add a [version plan](https://nx.dev/recipes/nx-release/file-based-versioning-version-plans#file-based-versioning-version-plans) to it.
13+
14+
```shell
15+
yarn nx release plan --message 'fix some bug' --only-touched=false patch
16+
```
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"label": "Releases",
3+
"position": 5,
4+
"link": { "type": "generated-index", "description": "Release guide for react-native-macos" },
5+
"collapsed": false
6+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
sidebar_label: 'Sync to a new minor release'
3+
sidebar_position: 3
4+
---
5+
6+
# Sync to a new upstream React Native patch release
7+
8+
Let's assume that React Native macOS is currently at `0.76`, and React Native `0.77` just releasd. We now need to merge all the commits up to `0.77`, and cut a new release branch.
9+
10+
Roughly, the steps look like so:
11+
12+
1. Find the commit that upstreams' `0.77-stable` branched off from `main`. You can use [git merge-base](https://git-scm.com/docs/git-merge-base) to do this, or manually inspect the commit history in the React Native repo.
13+
2. Merge that commit, which will result in a lot of merge conflicts. Resolving these merge conflicts is the bulk of the work. There's a couple of ways to go about this:
14+
1. Resolve all merge conflicts in place there and listing that in your PR notes
15+
2. Resolve enough conflictsto make a commit with git diff markers and do the rest as followup to make it easier for reviewers.
16+
3. When your PR is approved and ready to be merged, make sure to choose the option "Create a merge commit", as this preserves commit history and ensures git (and Github) accurately list hwo many commits ahead or behind of React Native we are:
17+
- ![Github ahead behind](../../static/img/github_ahead_behind.png)
18+
19+
20+
21+
22+
Some gotchas:
23+
24+
1. We ** do not ** want to just merge `upstream/0.77-stable` into our `main` branch, as the release branches contain commits that do not belong on `main` (bumping version numbers, local fixes, etc). This is why we look for the merge base
25+
2. It is common while doing the merge to take some particularly hairy commits (ex: a new iOS prop or feature that needs to be ported to macOS) and cherry-pick them into a separate PR so that the merge is easier or more reviewable.
26+
3. After you create your PR for review, you will need to rebase it often as either:
27+
- `main` moves forward because other PRs merge (such as the commits you cherry-picked into separate PRs)
28+
- You create commits to address feedback, and want to fold those back into the big merge commit, or separate discrete and well named commits
29+
3. It is necessary to rebase and not just merge the main branch as you normally would because we merge the whole PR as a merge commit, therefore all of your commits will be added to the git history. it would be better to have commits named `feat: port X feature to macOS` rather than `port stuff` / `pr feedback` / `undo`. Therefore, before you merge the PR, it's good to do one final rebase to clean up your branches git history.
30+
4. when you run `git merge <commit_hash>` and have all the merge conflicts locally, that’s a good spot to just copy/paste the output of the merge conflicts section of “git status” into your PR notes.
31+
5. GitHub chokes on these big PRs, but the [Github Pull Requests VS Code extension](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-pull-request-github) does not.
32+

docsite/docs/releases/overview.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
---
2+
sidebar_label: 'Overview'
3+
sidebar_position: 1
4+
---
5+
6+
# Contributing
7+
8+
This guide is intended for contributors driving a new release of React Native macOS, not the average contributor. It describes the steps needed to publish new minor and patch releases.
9+
10+
We assume your local git repository is setup with the following remotes, where `<user>` is your personal fork:
11+
```shell
12+
> git remote -v
13+
facebook [email protected]:facebook/react-native.git (fetch)
14+
facebook [email protected]:facebook/react-native.git (push)
15+
origin [email protected]:<user>/react-native-macos.git (fetch)
16+
origin [email protected]:<user>/react-native-macos.git (push)
17+
upstream [email protected]:microsoft/react-native-macos.git (fetch)
18+
upstream [email protected]:microsoft/react-native-macos.git (push)
19+
```
20+
21+
For an older version, of this guide, see [docs_archive/GitFlow](https://github.com/microsoft/react-native-macos/blob/85494dbbfc80621268a30c92df39f25d9fcfc98b/docs_archive/GitFlow.md)

0 commit comments

Comments
 (0)