forked from ant-design/ant-design
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
site: add my article (ant-design#39607)
* blog: add my article * site: update article * site: update article * feat: update article * docs: adjust words * docs: add invite part Co-authored-by: 二货机器人 <[email protected]>
- Loading branch information
Showing
2 changed files
with
318 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
--- | ||
title: How to Grow as a Collaborator | ||
date: 2022-12-08 | ||
author: heiyu4585 | ||
--- | ||
|
||
Hello everyone, I am [heiyu](https://github.com/heiyu4585). About Ant Design, I believe everyone is very familiar with it. Before I contributed to Ant Design, I have used Ant Design in many background management system projects at work. The biggest feeling for me is that it is easy to use, beautiful, simple and stable. Now that the v5 version has been released, I strongly recommend everyone to try it. I am also fortunate to have developed the v5 version of the `Tour` component and `App` component, as well as some other maintenance work. Let me share with you the PR process of Ant Design, hoping to provide a reference for who are interested in building together for the community. | ||
|
||
### Read related articles to familiarize yourself with related concepts | ||
|
||
[Contributing](https://ant.design/docs/react/contributing) | ||
|
||
[How to gracefully contribute code on github](https://segmentfault.com/a/1190000000736629) | ||
|
||
[Become a Community Collaborator](https://github.com/ant-design/ant-design/wiki/Collaborators#how-to-apply-for-being-a-collaborator) | ||
|
||
[developer notes](https://github.com/ant-design/ant-design/wiki/Development) | ||
|
||
[Some tips about git with PR](https://github.com/ant-design/ant-design/discussions/37051) | ||
|
||
## Pull Ant Design code to local | ||
|
||
### 1. Fork project | ||
|
||
- First you need to fork the project, enter the [project page](https://github.com/ant-design/ant-design), click the [Fork button](https://github.com/ant-design/ant-design/fork) | ||
- Ant Design link will appear in your github account is https://github.com/heiyu4585/ant-design this project | ||
- Use the following command on the project address on the local computer: get a github folder | ||
|
||
```bash | ||
git clone https://github.com/[yourGithubAccount]/ant-design.git | ||
``` | ||
|
||
Note: `[yourGithubAccount]` changed to your own github username | ||
|
||
### 2. Add remote branch address | ||
|
||
- Go to the Ant Design folder and add the remote address of Ant Design | ||
|
||
``` | ||
cd ant-design | ||
git remote add upstream https://github.com/ant-design/ant-design | ||
``` | ||
|
||
- Pull the latest remote branch version | ||
|
||
```bash | ||
git pull upstream master | ||
``` | ||
|
||
Now we are on the master branch from the fork, and this master is reserved for remote code tracking upstream | ||
|
||
### 3. Create a new fix branch on github | ||
|
||
 | ||
|
||
### 4. Pull the new branch locally | ||
|
||
```bash | ||
git pull | ||
git checkout fix-branch | ||
``` | ||
|
||
Now we can change the code on the branch | ||
|
||
## Find the issue on the [Ant Design issue](https://github.com/ant-design/ant-design/issues) page and analyze the selection | ||
|
||
To help you start your first attempt, we use [good first issues](https://github.com/ant-design/ant-design/issues?q=is%3Aissue+is%3Aopen+label%3A"good+first+issue") marks bugs and small features that are relatively easy to fix, and these issues are good as your first try. [help wanted](https://github.com/ant-design/ant-design/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) After all, it is easy to take over as a developer some problems. | ||
|
||
 | ||
|
||
## Development Process | ||
|
||
1. `npm start` A website running Ant Design locally | ||
2. As issue mentioned. Debug, fixing or add new feature | ||
|
||
## Run test cases and specification checks | ||
|
||
1. When add new related test case, also make sure all tests pass `npm run test`. Tips: You can use `npm test -- --watch TestName` to run specified tests during development. | ||
2. Run `npm test -- -u` to update [jest snapshot](https://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) and put These updates are also committed (if any). | ||
3. Make sure your code passes the lint check `npm run lint`. | ||
|
||
## Merge changes | ||
|
||
- A common problem is that the remote upstream (ant-design/master) has a new update, which will lead to conflicts when we submit the Pull Request, so we can put the commits of other remote developers and our commit is merged. | ||
|
||
- Switch to the `master` branch with the following code: | ||
|
||
```bash | ||
git checkout master | ||
``` | ||
|
||
- Use the following code to pull the latest code from the remote: | ||
|
||
```bash | ||
git pull upstream master | ||
``` | ||
|
||
- switch back to fix-branch | ||
|
||
```bash | ||
git checkout fix-branch | ||
``` | ||
|
||
- Merge the `commit` of `master` into `fix-branch`, and resolve conflicts if there are conflicts: | ||
|
||
```bash | ||
git rebase master | ||
``` | ||
|
||
- Submit the updated code to your own `fix-branch`: | ||
|
||
```bash | ||
git push origin fix-branch | ||
``` | ||
|
||
## Submit a Pull Request | ||
|
||
You can switch to the branches page on your github code repository page, click the fix-branch branch, click the `New pull request` button, add relevant comments and submit. Or switch to the code repository of the fix-branch branch, click the `Compare & pull request` button, add relevant comments and submit. | ||
|
||
- On the [PR page](https://github.com/ant-design/ant-design/pulls), carefully fill in the submission description according to the default format, and you can refer to the merged PR. | ||
|
||
- Check whether all the checks are passed. If you don’t click `details`, check the corresponding error report, and push again after repairing. | ||
|
||
 | ||
|
||
## Accept the maintainer's review and modify it, and wait for the maintainer to merge after passing the test | ||
|
||
 | ||
|
||
## Common errors | ||
|
||
- PR description is not filled in as required | ||
|
||
 | ||
|
||
- Not rebase to latest version | ||
|
||
 | ||
|
||
- react 16 test failed | ||
|
||
 | ||
|
||
Repair method: | ||
|
||
```bash | ||
npm run install-react-16 | ||
npm run test component/XXX | ||
``` | ||
|
||
## To be collaborator | ||
|
||
After a period of continuous maintenance, Collaborators will start the invitation mechanism and initiate a vote in [#3222](https://github.com/ant-design/ant-design/issues/3222). When enough votes are met, you will be officially invited to become a Collaborator. | ||
|
||
 | ||
|
||
## Don't be afraid to make mistakes, do it bravely, everyone is welcome in the open source world. | ||
|
||
 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
--- | ||
title: 如何成长为 Collaborator | ||
date: 2022-12-08 | ||
author: heiyu4585 | ||
--- | ||
|
||
大家好,我是[黑雨](https://github.com/heiyu4585)。关于 Ant Design,相信大家都非常熟悉,我在很多后台管理系统项目使用过 Ant Design,给我最大的感觉就是好用、好看、简单、稳定。现在 `v5` 版本已经发布,强烈推荐大家试使用,我也有幸开发了 `v5` 版本的 `Tour` 组件和 `App` 组件,以及一些其他维护工作。下面给大家分享一下 Ant Design 的 PR 流程,希望能给有兴趣为社区共建的同学提供一份参考。 | ||
|
||
## 一. 阅读相关文章熟悉相关概念 | ||
|
||
[贡献指南](https://ant.design/docs/react/contributing-cn) | ||
|
||
[如何优雅地在 github 上贡献代码](https://segmentfault.com/a/1190000000736629) | ||
|
||
[成为社区协作成员](https://github.com/ant-design/ant-design/wiki/Collaborators#how-to-apply-for-being-a-collaborator) | ||
|
||
[开发者说明](https://github.com/ant-design/ant-design/wiki/Development) | ||
|
||
[使用 git 创建 PR 的一些建议](https://github.com/ant-design/ant-design/discussions/37051) | ||
|
||
## 二. 拉取 Ant Design 代码到本地 | ||
|
||
### 1. Fork 项目 | ||
|
||
- 首先需要 fork 项目,进入[项目页面](https://github.com/ant-design/ant-design),点击右上角的 [Fork 按钮](https://github.com/ant-design/ant-design/fork) | ||
- 你的 github 帐号中会出现 Ant Design 链接是 https://github.com/heiyu4585/ant-design 这个项目 | ||
- 在本地电脑上项目地址使用以下命令:得到一个 github 文件夹 | ||
|
||
```bash | ||
git clone https://github.com/[yourGithubAccount]/ant-design.git | ||
``` | ||
|
||
注意: `[yourGithubAccount]` 改为自己的 github 用户名 | ||
|
||
### 2. 添加远端分支地址 | ||
|
||
- 进入 Ant Design 文件夹,添加 Ant Design 的远程地址 | ||
|
||
```bash | ||
cd ant-design | ||
git remote add upstream https://github.com/ant-design/ant-design | ||
``` | ||
|
||
- 拉取最新的远端分支版本 | ||
|
||
```bash | ||
git pull upstream master | ||
``` | ||
|
||
现在我们在 fork 来的 master 分支上,这个 master 留作跟踪 upstream 的远程代码 | ||
|
||
### 3. 在 github 上创建新 fix 分支 | ||
|
||
 | ||
|
||
### 4. 在本地拉取新分支 | ||
|
||
```bash | ||
git pull | ||
git checkout fix-branch | ||
``` | ||
|
||
现在我们可以在分支上更改代码了 | ||
|
||
## 三. 在[Ant Design 的 issue](https://github.com/ant-design/ant-design/issues)页找到 issue 并分析选择 | ||
|
||
为了能帮助你开始你的第一次尝试,我们用 [good first issues](https://github.com/ant-design/ant-design/issues?q=is%3Aissue+is%3Aopen+label%3A"good+first+issue") 标记了一些比较容易修复的 bug 和小功能,这些 issue 可以很好地作为你的首次尝试。[help wanted](https://github.com/ant-design/ant-design/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22) 是作为开发者比较容易接手的一些问题。 | ||
|
||
 | ||
|
||
## 四. 开发流程 | ||
|
||
1. `npm start` 在本地运行 Ant Design 的网站 | ||
2. 按照 issue 描述调试、修复问题或者开发新的 feature | ||
|
||
## 五. 运行测试用例及规范检查 | ||
|
||
1. 在添加 issue 相关测试用例同时,确认所有的测试都是通过的 `npm run test`。 小贴士:开发过程中可以用 `npm test -- --watch TestName` 来运行指定的测试。 | ||
2. 运行 `npm test -- -u` 来更新 [jest snapshot](https://facebook.github.io/jest/docs/en/snapshot-testing.html#snapshot-testing-with-jest) 并且把这些更新也提交上来(如果有的话)。 | ||
3. 确保你的代码通过了 lint 检查 `npm run lint`。 | ||
|
||
## 六. 合并修改 | ||
|
||
- 一个常见的问题是远程的 upstream (ant-design/master) 有了新的更新,从而会导致我们提交的 Pull Request 时会导致冲突,因此我们可以在提交前先把远程其他开发者的 commit 和我们的 commit 合并。 | ||
|
||
- 使用以下代码切换到 `master` 分支: | ||
|
||
```bash | ||
git checkout master | ||
``` | ||
|
||
- 使用以下代码拉出远程的最新代码: | ||
|
||
```bash | ||
git pull upstream master | ||
``` | ||
|
||
- 切换回 fix-branch | ||
|
||
```bash | ||
git checkout fix-branch | ||
``` | ||
|
||
- 把 `master` 的 `commit `合并到 `fix-branch`,有冲突解决冲突: | ||
|
||
```bash | ||
git rebase master | ||
``` | ||
|
||
- 把更新代码提交到自己的 `fix-branch` 中: | ||
|
||
```bash | ||
git push origin fix-branch | ||
``` | ||
|
||
## 七. 提交 Pull Request | ||
|
||
你可以在你的 github 代码仓库页面切换到 branches 页面点击 fix-branch 分支后点击 `New pull request` 按钮,添加相关注释后提交. 或者切换到 fix-branch 分支的代码仓库点击 `Compare & pull request` 按钮,添加相关注释后提交. | ||
|
||
- [PR 页面](https://github.com/ant-design/ant-design/pulls) 上按照默认格式认真填写提交描述,可以参考已经 merge 的 PR。 | ||
|
||
- 查看 checks 是否全部通过,如果没有点 `details` 就去查看对应的报错,修复后重新 push。 | ||
|
||
 | ||
|
||
## 八. 接受维护者的 review 并修改,合格后等待维护者 merge | ||
|
||
 | ||
|
||
## 九. 常见错误 | ||
|
||
- PR 描述未按要求填写 | ||
|
||
 | ||
|
||
- 未 rebase 到最新版本 | ||
|
||
 | ||
|
||
- react 16 test 未通过 | ||
|
||
 | ||
|
||
修复方法: | ||
|
||
``` | ||
npm run install-react-16 | ||
npm run test componet/XXX | ||
``` | ||
|
||
## 十. 成为 Collaborator | ||
|
||
当持续维护一段时候后,Collaborator 会启动邀请机制,在 [#3222](https://github.com/ant-design/ant-design/issues/3222) 中发起投票。当满足足够票数后,会正式邀请你成为 Collaborator。 | ||
|
||
 | ||
|
||
## 不要怕犯错误,勇敢地去做,开源世界欢迎大家。 | ||
|
||
 |