|
| 1 | +# Contributing to node-core-utils |
| 2 | + |
| 3 | +This document will guide you through the contribution process. |
| 4 | + |
| 5 | +### Step 1: Fork |
| 6 | + |
| 7 | +Fork the project [on GitHub](https://github.com/joyeecheung/node-core-utils) |
| 8 | +and check out your copy locally. |
| 9 | + |
| 10 | +```bash |
| 11 | +$ git clone git@github.com:username/node-core-utils.git |
| 12 | +$ cd node-core-utils |
| 13 | +$ git remote add upstream git@github.com:joyeecheung/node-core-utils.git |
| 14 | +``` |
| 15 | + |
| 16 | +#### Which branch? |
| 17 | + |
| 18 | +For developing new features and bug fixes, the `master` branch should be pulled |
| 19 | +and built upon. |
| 20 | + |
| 21 | +### Step 2: Branch |
| 22 | + |
| 23 | +Create a feature branch and start hacking: |
| 24 | + |
| 25 | +```bash |
| 26 | +$ git checkout -b my-feature-branch -t origin/my-feature-branch |
| 27 | +``` |
| 28 | + |
| 29 | +### Step 3: Commit |
| 30 | + |
| 31 | +Make sure git knows your name and email address: |
| 32 | + |
| 33 | +```bash |
| 34 | +# In the project directory |
| 35 | +$ git config user.name "J. Random User" |
| 36 | +$ git config user.email "j.random.user@example.com" |
| 37 | +``` |
| 38 | + |
| 39 | +Writing good commit logs is important. A commit log should describe what |
| 40 | +changed and why. Follow these guidelines when writing one: |
| 41 | + |
| 42 | +1. The first line should be a short description of the change |
| 43 | + (e.g. "get-metadata: check if the committer matches the author"). |
| 44 | +2. Keep the second line blank. |
| 45 | +3. Wrap all lines at 72 columns. |
| 46 | + |
| 47 | +The header line should be meaningful; it is what other people see when they |
| 48 | +run `git shortlog` or `git log --oneline`. |
| 49 | + |
| 50 | +If your patch fixes an open issue, you can add a reference to it at the end |
| 51 | +of the log. Use the `Fixes:` prefix and the full issue URL. For example: |
| 52 | + |
| 53 | +``` |
| 54 | +Fixes: https://github.com/joyeecheung/node-core-utils/issues/1 |
| 55 | +``` |
| 56 | + |
| 57 | +### Step 4: Rebase |
| 58 | + |
| 59 | +Use `git rebase` (not `git merge`) to sync your work from time to time. |
| 60 | + |
| 61 | +```bash |
| 62 | +$ git checkout my-feature-branch |
| 63 | +$ git fetch upstream |
| 64 | +$ git rebase upstream/master |
| 65 | +``` |
| 66 | + |
| 67 | +### Step 5: Test |
| 68 | + |
| 69 | +Bug fixes and features should come with tests. Add your tests in the |
| 70 | +`test` directory. The general rule is, if the test does not need to send |
| 71 | +any requests to external servers, put it in `test/unit`. Otherwise put it |
| 72 | +in `test/intergration`. Test fixtures should be placed in `test/fixtures`. |
| 73 | + |
| 74 | +```bash |
| 75 | +$ npm install |
| 76 | +# To run the unit tests |
| 77 | +$ npm test |
| 78 | +# To run all the tests |
| 79 | +$ npm run test-all |
| 80 | +``` |
| 81 | + |
| 82 | +Make sure the linter is happy and that all tests pass before submitting a |
| 83 | +pull request. |
| 84 | + |
| 85 | +### Step 6: Push |
| 86 | + |
| 87 | +```bash |
| 88 | +$ git push origin my-feature-branch |
| 89 | +# Or if you have pushed before and have rebased after that, |
| 90 | +# do git push --force origin my-feature-branch instead |
| 91 | +``` |
| 92 | + |
| 93 | +Go to https://github.com/yourusername/node-core-utils and |
| 94 | +select your feature branch. Click the 'Pull Request' button |
| 95 | +and fill out the form. |
| 96 | + |
| 97 | +Pull requests are usually reviewed within a few days. If there are comments |
| 98 | +to address, apply your changes in a separate commit and push that to your |
| 99 | +feature branch. Post a comment in the pull request afterwards. |
| 100 | + |
| 101 | +## Code of Conduct |
| 102 | + |
| 103 | +We follow the |
| 104 | +[Node.js Code of Conduct](https://github.com/nodejs/TSC/blob/master/CODE_OF_CONDUCT.md) |
| 105 | +in this project. |
| 106 | + |
| 107 | +## Developer's Certificate of Origin 1.1 |
| 108 | + |
| 109 | +By making a contribution to this project, I certify that: |
| 110 | + |
| 111 | +* (a) The contribution was created in whole or in part by me and I |
| 112 | + have the right to submit it under the open source license |
| 113 | + indicated in the file; or |
| 114 | + |
| 115 | +* (b) The contribution is based upon previous work that, to the best |
| 116 | + of my knowledge, is covered under an appropriate open source |
| 117 | + license and I have the right under that license to submit that |
| 118 | + work with modifications, whether created in whole or in part |
| 119 | + by me, under the same open source license (unless I am |
| 120 | + permitted to submit under a different license), as indicated |
| 121 | + in the file; or |
| 122 | + |
| 123 | +* (c) The contribution was provided directly to me by some other |
| 124 | + person who certified (a), (b) or (c) and I have not modified |
| 125 | + it. |
| 126 | + |
| 127 | +* (d) I understand and agree that this project and the contribution |
| 128 | + are public and that a record of the contribution (including all |
| 129 | + personal information I submit with it, including my sign-off) is |
| 130 | + maintained indefinitely and may be redistributed consistent with |
| 131 | + this project or the open source license(s) involved. |
0 commit comments