This document will guide you through the contribution process.
Fork the project on GitHub and check out your copy locally.
$ git clone git@github.com:username/node-core-utils.git
$ cd node-core-utils
$ git remote add upstream git@github.com:nodejs/node-core-utils.git
For developing new features and bug fixes, the main
branch should be pulled
and built upon.
Create a feature branch and start hacking:
$ git checkout -b my-feature-branch -t origin/my-feature-branch
Make sure git knows your name and email address:
# In the project directory
$ git config user.name "J. Random User"
$ git config user.email "j.random.user@example.com"
Writing good commit logs is important. A commit log should describe what changed and why. Follow these guidelines when writing one:
- The first line should be a short description of the change (e.g. "get-metadata: check if the committer matches the author").
- Keep the second line blank.
- Wrap all lines at 72 columns.
The header line should be meaningful; it is what other people see when they
run git shortlog
or git log --oneline
.
If your patch fixes an open issue, you can add a reference to it at the end
of the log. Use the Fixes:
prefix and the full issue URL. For example:
Fixes: https://github.com/nodejs/node-core-utils/issues/1
Use git rebase
(not git merge
) to sync your work from time to time.
$ git checkout my-feature-branch
$ git fetch upstream
$ git rebase upstream/main
Bug fixes and features should come with tests. Add your tests in the
test
directory. The general rule is, if the test does not need to send
any requests to external servers, put it in test/unit
. Otherwise put it
in test/integration
. Test fixtures should be placed in test/fixtures
.
$ npm install
# To run the unit tests
$ npm test
# To run all the tests
$ npm run test-all
Make sure the linter is happy and that all tests pass before submitting a pull request.
$ git push origin my-feature-branch
# Or if you have pushed before and have rebased after that,
# do git push --force origin my-feature-branch instead
Go to https://github.com/yourusername/node-core-utils and select your feature branch. Click the 'Pull Request' button and fill out the form.
Pull requests are usually reviewed within a few days. If there are comments to address, apply your changes in a separate commit and push that to your feature branch. Post a comment in the pull request afterwards.
We follow the Node.js Code of Conduct in this project.
By making a contribution to this project, I certify that:
-
(a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or
-
(b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or
-
(c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it.
-
(d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved.