1 # Contributing to Node.js
5 When opening new issues or commenting on existing issues on this repository
6 please make sure discussions are related to concrete technical issues with the
9 Discussion of non-technical topics including subjects like intellectual
10 property, trademark and high level project questions should move to the
11 [node-forward discussions repository](https://github.com/node-forward/discussions)
16 The Node.js project has an open governance model and welcomes new contributors.
17 Individuals making significant and valuable contributions are made
18 _Collaborators_ and given commit-access to the project. See the
19 [GOVERNANCE.md](./GOVERNANCE.md) document for more information about how this
22 This document will guide you through the contribution process.
26 Fork the project [on GitHub](https://github.com/nodejs/node) and check out your
30 $ git clone git@github.com:username/node.git
32 $ git remote add upstream git://github.com/nodejs/node.git
37 For developing new features and bug fixes, the `master` branch should be pulled
40 #### Respect the stability index
42 The rules for the master branch are less strict; consult the
43 [stability index](./doc/api/documentation.markdown#stability-index) for details.
45 In a nutshell, modules are at varying levels of API stability. Bug fixes are
46 always welcome but API or behavioral changes to modules at stability level 3
47 (Locked) are off-limits.
51 Node.js has several bundled dependencies in the *deps/* and the *tools/*
52 directories that are not part of the project proper. Any changes to files
53 in those directories or its subdirectories should be sent to their respective
54 projects. Do not send your patch to us, we cannot accept it.
56 In case of doubt, open an issue in the
57 [issue tracker](https://github.com/nodejs/node/issues/) or contact one of the
58 [project Collaborators](https://github.com/nodejs/node/#current-project-team-members).
59 ([IRC](http://webchat.freenode.net/?channels=io.js) is often the best medium.) Especially do so if you plan to work on something big. Nothing is more
60 frustrating than seeing your hard work go to waste because your vision
61 does not align with the project team.
66 Create a feature branch and start hacking:
69 $ git checkout -b my-feature-branch -t origin/master
74 Make sure git knows your name and email address:
77 $ git config --global user.name "J. Random User"
78 $ git config --global user.email "j.random.user@example.com"
81 Writing good commit logs is important. A commit log should describe what
82 changed and why. Follow these guidelines when writing one:
84 1. The first line should be 50 characters or less and contain a short
85 description of the change prefixed with the name of the changed
86 subsystem (e.g. "net: add localAddress and localPort to Socket").
87 2. Keep the second line blank.
88 3. Wrap all other lines at 72 columns.
90 A good commit log can look something like this:
93 subsystem: explaining the commit in one line
95 Body of commit message is a few lines of text, explaining things
96 in more detail, possibly giving some background about the issue
97 being fixed, etc. etc.
99 The body of the commit message can be several paragraphs, and
100 please do proper word-wrap and keep columns shorter than about
101 72 characters or so. That way `git log` will show things
102 nicely even when it is indented.
105 The header line should be meaningful; it is what other people see when they
106 run `git shortlog` or `git log --oneline`.
108 Check the output of `git log --oneline files_that_you_changed` to find out
109 what subsystem (or subsystems) your changes touch.
114 Use `git rebase` (not `git merge`) to sync your work from time to time.
118 $ git rebase upstream/master
124 Bug fixes and features **should come with tests**. Add your tests in the
125 test/parallel/ directory. Look at other tests to see how they should be
126 structured (license boilerplate, common includes, etc.).
129 $ ./configure && make -j8 test
132 Make sure the linter is happy and that all tests pass. Please, do not submit
133 patches that fail either check.
135 If you are updating tests and just want to run a single test to check it, you
136 can use this syntax to run it exactly as the test harness would:
139 $ python tools/test.py -v --mode=release parallel/test-stream2-transform
142 You can run tests directly with node:
145 $ ./node ./test/parallel/test-stream2-transform.js
148 Remember to recompile with `make -j8` in between test runs if you change
154 $ git push origin my-feature-branch
157 Go to https://github.com/yourusername/node and select your feature branch.
158 Click the 'Pull Request' button and fill out the form.
160 Pull requests are usually reviewed within a few days. If there are comments
161 to address, apply your changes in a separate commit and push that to your
162 feature branch. Post a comment in the pull request afterwards; GitHub does
163 not send out notifications when you add commits.
166 ## Developer's Certificate of Origin 1.0
168 By making a contribution to this project, I certify that:
170 * (a) The contribution was created in whole or in part by me and I
171 have the right to submit it under the open source license indicated
173 * (b) The contribution is based upon previous work that, to the best
174 of my knowledge, is covered under an appropriate open source license
175 and I have the right under that license to submit that work with
176 modifications, whether created in whole or in part by me, under the
177 same open source license (unless I am permitted to submit under a
178 different license), as indicated in the file; or
179 * (c) The contribution was provided directly to me by some other
180 person who certified (a), (b) or (c) and I have not modified it.
185 This Code of Conduct is adapted from [Rust's wonderful
186 CoC](http://www.rust-lang.org/conduct.html).
188 * We are committed to providing a friendly, safe and welcoming
189 environment for all, regardless of gender, sexual orientation,
190 disability, ethnicity, religion, or similar personal characteristic.
191 * Please avoid using overtly sexual nicknames or other nicknames that
192 might detract from a friendly, safe and welcoming environment for
194 * Please be kind and courteous. There's no need to be mean or rude.
195 * Respect that people have differences of opinion and that every
196 design or implementation choice carries a trade-off and numerous
197 costs. There is seldom a right answer.
198 * Please keep unstructured critique to a minimum. If you have solid
199 ideas you want to experiment with, make a fork and see how it works.
200 * We will exclude you from interaction if you insult, demean or harass
201 anyone. That is not welcome behaviour. We interpret the term
202 "harassment" as including the definition in the [Citizen Code of
203 Conduct](http://citizencodeofconduct.org/); if you have any lack of
204 clarity about what might be included in that concept, please read
205 their definition. In particular, we don't tolerate behavior that
206 excludes people in socially marginalized groups.
207 * Private harassment is also unacceptable. No matter who you are, if
208 you feel you have been or are being harassed or made uncomfortable
209 by a community member, please contact one of the channel ops or any
210 of the TC members immediately with a capture (log, photo, email) of
211 the harassment if possible. Whether you're a regular contributor or
212 a newcomer, we care about making this community a safe place for you
213 and we've got your back.
214 * Likewise any spamming, trolling, flaming, baiting or other
215 attention-stealing behaviour is not welcome.
216 * Avoid the use of personal pronouns in code comments or
217 documentation. There is no need to address persons when explaining
218 code (e.g. "When the developer")