|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for being willing to contribute! |
| 4 | + |
| 5 | +**Working on your first Pull Request?** You can learn how from this _free_ series |
| 6 | +[How to Contribute to an Open Source Project on GitHub][egghead] |
| 7 | + |
| 8 | +## Project setup |
| 9 | + |
| 10 | +1. Fork and clone the repo |
| 11 | +2. Run `npm run setup -s` to install dependencies and run validation |
| 12 | +3. Create a branch for your PR with `git checkout -b pr/your-branch-name` |
| 13 | + |
| 14 | +> Tip: Keep your `master` branch pointing at the original repository and make |
| 15 | +> pull requests from branches on your fork. To do this, run: |
| 16 | +> |
| 17 | +> ``` |
| 18 | +> git remote add upstream https://github.com/kentcdodds/react-testing-library.git |
| 19 | +> git fetch upstream |
| 20 | +> git branch --set-upstream-to=upstream/master master |
| 21 | +> ``` |
| 22 | +> |
| 23 | +> This will add the original repository as a "remote" called "upstream," |
| 24 | +> Then fetch the git information from that remote, then set your local `master` |
| 25 | +> branch to use the upstream master branch whenever you run `git pull`. |
| 26 | +> Then you can make all of your pull request branches based on this `master` |
| 27 | +> branch. Whenever you want to update your version of `master`, do a regular |
| 28 | +> `git pull`. |
| 29 | +
|
| 30 | +## Add yourself as a contributor |
| 31 | +
|
| 32 | +This project follows the [all contributors][all-contributors] specification. |
| 33 | +To add yourself to the table of contributors on the `README.md`, please use the |
| 34 | +automated script as part of your PR: |
| 35 | +
|
| 36 | +```console |
| 37 | +npm run add-contributor |
| 38 | +``` |
| 39 | +
|
| 40 | +Follow the prompt and commit `.all-contributorsrc` and `README.md` in the PR. |
| 41 | +If you've already added yourself to the list and are making |
| 42 | +a new type of contribution, you can run it again and select the added |
| 43 | +contribution type. |
| 44 | + |
| 45 | +## Committing and Pushing changes |
| 46 | + |
| 47 | +Please make sure to run the tests before you commit your changes. You can run |
| 48 | +`npm run test:update` which will update any snapshots that need updating. |
| 49 | +Make sure to include those changes (if they exist) in your commit. |
| 50 | + |
| 51 | +### opt into git hooks |
| 52 | + |
| 53 | +There are git hooks set up with this project that are automatically installed |
| 54 | +when you install dependencies. They're really handy, but are turned off by |
| 55 | +default (so as to not hinder new contributors). You can opt into these by |
| 56 | +creating a file called `.opt-in` at the root of the project and putting this |
| 57 | +inside: |
| 58 | + |
| 59 | +``` |
| 60 | +pre-commit |
| 61 | +``` |
| 62 | + |
| 63 | +## Help needed |
| 64 | + |
| 65 | +Please checkout the [the open issues][issues] |
| 66 | + |
| 67 | +Also, please watch the repo and respond to questions/bug reports/feature |
| 68 | +requests! Thanks! |
| 69 | + |
| 70 | +[egghead]: https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github |
| 71 | +[all-contributors]: https://github.com/kentcdodds/all-contributors |
| 72 | +[issues]: https://github.com/kentcdodds/react-testing-library/issues |
0 commit comments