Skip to content

Commit e45d69f

Browse files
committed
doc:spin off technical guide
1 parent 97ec72b commit e45d69f

File tree

2 files changed

+297
-296
lines changed

2 files changed

+297
-296
lines changed

CONTRIBUTING.md

Lines changed: 2 additions & 296 deletions
Original file line numberDiff line numberDiff line change
@@ -28,302 +28,8 @@ _Collaborators_ and given commit-access to the project. See the
2828
[GOVERNANCE.md](./GOVERNANCE.md) document for more information about how this
2929
works.
3030

31-
This document will guide you through the contribution process.
32-
33-
### Step 1: Fork
34-
35-
Fork the project [on GitHub](https://github.com/nodejs/node) and check out your
36-
copy locally.
37-
38-
```text
39-
$ git clone git@github.com:username/node.git
40-
$ cd node
41-
$ git remote add upstream git://github.com/nodejs/node.git
42-
```
43-
44-
#### Which branch?
45-
46-
For developing new features and bug fixes, the `master` branch should be pulled
47-
and built upon.
48-
49-
#### Dependencies
50-
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 a patch to Node.js. We cannot accept such patches.
55-
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-
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. (Node.js has two IRC channels:
62-
[#Node.js](http://webchat.freenode.net/?channels=node.js) for general help and
63-
questions, and
64-
[#Node-dev](http://webchat.freenode.net/?channels=node-dev) for development of
65-
Node.js core specifically).
66-
67-
For instructions on updating the version of V8 included in the *deps/*
68-
directory, please refer to [the Maintaining V8 in Node.js guide](https://github.com/nodejs/node/blob/master/doc/guides/maintaining-V8.md).
69-
70-
71-
### Step 2: Branch
72-
73-
Create a branch and start hacking:
74-
75-
```text
76-
$ git checkout -b my-branch -t origin/master
77-
```
78-
79-
Any text you write should follow the [Style Guide](doc/STYLE_GUIDE.md),
80-
including comments and API documentation.
81-
82-
### Step 3: Commit
83-
84-
Make sure git knows your name and email address:
85-
86-
```text
87-
$ git config --global user.name "J. Random User"
88-
$ git config --global user.email "j.random.user@example.com"
89-
```
90-
91-
Add and commit:
92-
93-
```text
94-
$ git add my/changed/files
95-
$ git commit
96-
```
97-
98-
### Commit guidelines
99-
100-
Writing good commit logs is important. A commit log should describe what
101-
changed and why. Follow these guidelines when writing one:
102-
103-
1. The first line should:
104-
- contain a short description of the change
105-
- be 50 characters or less
106-
- be entirely in lowercase with the exception of proper nouns, acronyms, and
107-
the words that refer to code, like function/variable names
108-
- be prefixed with the name of the changed subsystem and start with an
109-
imperative verb. Examples: "net: add localAddress and localPort
110-
to Socket", "src: fix typos in node_lttng_provider.h"
111-
- be meaningful; it is what other people see when they
112-
run `git shortlog` or `git log --oneline`.<br>
113-
Check the output of `git log --oneline files/you/changed` to find out
114-
what subsystem (or subsystems) your changes touch
115-
2. Keep the second line blank.
116-
3. Wrap all other lines at 72 columns.
117-
- If your patch fixes an open issue, you can add a reference to it at the end
118-
of the log. Use the `Fixes:` prefix and the full issue URL. For other references
119-
use `Refs:`. For example:
120-
```txt
121-
Fixes: https://github.com/nodejs/node/issues/1337
122-
Refs: http://eslint.org/docs/rules/space-in-parens.html
123-
Refs: https://github.com/nodejs/node/pull/3615
124-
```
125-
126-
A good commit log can look something like this:
127-
128-
```txt
129-
subsystem: explain the commit in one line
130-
131-
Body of commit message is a few lines of text, explaining things
132-
in more detail, possibly giving some background about the issue
133-
being fixed, etc.
134-
135-
The body of the commit message can be several paragraphs, and
136-
please do proper word-wrap and keep columns shorter than about
137-
72 characters or so. That way, `git log` will show things
138-
nicely even when it is indented.
139-
140-
Fixes: https://github.com/nodejs/node/issues/1337
141-
Refs: http://eslint.org/docs/rules/space-in-parens.html
142-
```
143-
144-
### Step 4: Rebase
145-
146-
Use `git rebase` (not `git merge`) to sync your work from time to time.
147-
148-
```text
149-
$ git fetch upstream
150-
$ git rebase upstream/master
151-
```
152-
153-
### Step 5: Test
154-
155-
Bug fixes and features **should come with tests**. Add your tests in the
156-
`test/parallel/` directory. For guidance on how to write a test for the Node.js
157-
project, see this [guide](./doc/guides/writing-tests.md). Looking at other tests
158-
to see how they should be structured can also help.
159-
160-
To run the tests on Unix / macOS:
161-
162-
```text
163-
$ ./configure && make -j4 test
164-
```
165-
166-
Windows:
167-
168-
```text
169-
> vcbuild test
170-
```
171-
172-
(See the [BUILDING.md](./BUILDING.md) for more details.)
173-
174-
Make sure the linter does not report any issues and that all tests pass. Please
175-
do not submit patches that fail either check.
176-
177-
Running `make test`/`vcbuild test` will run the linter as well unless one or
178-
more tests fail.
179-
180-
If you want to run the linter without running tests, use
181-
`make lint`/`vcbuild lint`. It will run both JavaScript linting and
182-
C++ linting.
183-
184-
If you are updating tests and just want to run a single test to check it, you
185-
can use this syntax to run it exactly as the test harness would:
186-
187-
```text
188-
$ python tools/test.py -v --mode=release parallel/test-stream2-transform
189-
```
190-
191-
You can run tests directly with node:
192-
193-
```text
194-
$ ./node ./test/parallel/test-stream2-transform.js
195-
```
196-
197-
Remember to recompile with `make -j4` in between test runs if you change
198-
core modules.
199-
200-
### Step 6: Push
201-
202-
```text
203-
$ git push origin my-branch
204-
```
205-
206-
Pull requests are usually reviewed within a few days.
207-
208-
### Step 7: Discuss and update
209-
210-
You will probably get feedback or requests for changes to your Pull Request.
211-
This is a big part of the submission process so don't be disheartened!
212-
213-
To make changes to an existing Pull Request, make the changes to your branch.
214-
When you push that branch to your fork, GitHub will automatically update the
215-
Pull Request.
216-
217-
You can push more commits to your branch:
218-
219-
```text
220-
$ git add my/changed/files
221-
$ git commit
222-
$ git push origin my-branch
223-
```
224-
225-
Or you can rebase against master:
226-
227-
```text
228-
$ git fetch --all
229-
$ git rebase origin/master
230-
$ git push --force-with-lease origin my-branch
231-
```
232-
233-
Or you can amend the last commit (for example if you want to change the commit
234-
log).
235-
236-
```text
237-
$ git add any/changed/files
238-
$ git commit --amend
239-
$ git push --force-with-lease origin my-branch
240-
```
241-
242-
**Important:** The `git push --force-with-lease` command is one of the few ways
243-
to delete history in git. Before you use it, make sure you understand the risks.
244-
If in doubt, you can always ask for guidance in the Pull Request or on
245-
[IRC in the #node-dev channel](https://webchat.freenode.net?channels=node-dev&uio=d4).
246-
247-
Feel free to post a comment in the Pull Request to ping reviewers if you are
248-
awaiting an answer on something. If you encounter words or acronyms that
249-
seem unfamiliar, refer to this
250-
[glossary](https://sites.google.com/a/chromium.org/dev/glossary).
251-
252-
Note that multiple commits often get squashed when they are landed (see the
253-
notes about [commit squashing](#commit-squashing)).
254-
255-
### Step 8: Landing
256-
257-
In order to land, a Pull Request needs to be reviewed and
258-
[approved](#getting-approvals-for-your-pull-request) by
259-
at least one Node.js Collaborator and pass a
260-
[CI (Continuous Integration) test run](#ci-testing).
261-
After that, as long as there are no objections
262-
from a Collaborator, the Pull Request can be merged. If you find your
263-
Pull Request waiting longer than you expect, see the
264-
[notes about the waiting time](#waiting-until-the-pull-request-gets-landed).
265-
266-
When a collaborator lands your Pull Request, they will post
267-
a comment to the Pull Request page mentioning the commit(s) it
268-
landed as. GitHub often shows the Pull Request as `Closed` at this
269-
point, but don't worry. If you look at the branch you raised your
270-
Pull Request against (probably `master`), you should see a commit with
271-
your name on it. Congratulations and thanks for your contribution!
272-
273-
## Additional Notes
274-
275-
### Commit Squashing
276-
277-
When the commits in your Pull Request land, they will be squashed
278-
into one commit per logical change. Metadata will be added to the commit
279-
message (including links to the Pull Request, links to relevant issues,
280-
and the names of the reviewers). The commit history of your Pull Request,
281-
however, will stay intact on the Pull Request page.
282-
283-
For the size of "one logical change",
284-
[0b5191f](https://github.com/nodejs/node/commit/0b5191f15d0f311c804d542b67e2e922d98834f8)
285-
can be a good example. It touches the implementation, the documentation,
286-
and the tests, but is still one logical change. In general, the tests should
287-
always pass when each individual commit lands on the master branch.
288-
289-
### Getting Approvals for Your Pull Request
290-
291-
A Pull Request is approved either by saying LGTM, which stands for
292-
"Looks Good To Me", or by using GitHub's Approve button.
293-
GitHub's Pull Request review feature can be used during the process.
294-
For more information, check out
295-
[the video tutorial](https://www.youtube.com/watch?v=HW0RPaJqm4g)
296-
or [the official documentation](https://help.github.com/articles/reviewing-changes-in-pull-requests/).
297-
298-
After you push new changes to your branch, you need to get
299-
approval for these new changes again, even if GitHub shows "Approved"
300-
because the reviewers have hit the buttons before.
301-
302-
### CI Testing
303-
304-
Every Pull Request needs to be tested
305-
to make sure that it works on the platforms that Node.js
306-
supports. This is done by running the code through the CI system.
307-
308-
Only a Collaborator can start a CI run. Usually one of them will do it
309-
for you as approvals for the Pull Request come in.
310-
If not, you can ask a Collaborator to start a CI run.
311-
312-
### Waiting Until the Pull Request Gets Landed
313-
314-
A Pull Request needs to stay open for at least 48 hours (72 hours on a
315-
weekend) from when it is submitted, even after it gets approved and
316-
passes the CI. This is to make sure that everyone has a chance to
317-
weigh in. If the changes are trivial, collaborators may decide it
318-
doesn't need to wait. A Pull Request may well take longer to be
319-
merged in. All these precautions are important because Node.js is
320-
widely used, so don't be discouraged!
321-
322-
### Check Out the Collaborator's Guide
323-
324-
If you want to know more about the code review and the landing process,
325-
you can take a look at the
326-
[collaborator's guide](https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md).
31+
The [HOWTO](./doc/guides/HOWTO-contribute-technical.md) document will guide you
32+
through the contribution process.
32733

32834
<a id="developers-certificate-of-origin"></a>
32935
## Developer's Certificate of Origin 1.1

0 commit comments

Comments
 (0)