Skip to content

Commit fd99cb1

Browse files
authored
docs: add instructions and details to contributors guide (cloudevents#105)
This commit adds instructions and details to contributors guide and provides detailed guidance for pull requests and maintainers in separate documents. Signed-off-by: Lance Ball <lball@redhat.com>
1 parent ef7550d commit fd99cb1

File tree

3 files changed

+230
-45
lines changed

3 files changed

+230
-45
lines changed

CONTRIBUTING.md

+24-45
Original file line numberDiff line numberDiff line change
@@ -2,61 +2,40 @@
22

33
:+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
44

5-
Following you will see some guidelines about how to contribute with
6-
JavaScript SDK.
7-
8-
## Branch Management
9-
10-
We use Gitflow to manage our branches and that's ok when `develop` branch is
11-
ahead of `master`.
12-
13-
- [Gitflow](https://nvie.com/posts/a-successful-git-branching-model/) by @nvie
14-
15-
## Changelog
16-
17-
The [CHANGELOG.md](./CHANGELOG.md) will be updated with your commits if you format
18-
your commit messages following the
19-
[Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/#summary).
20-
If you are unsure what prefix to use for a commit, you can consult the
21-
[package.json](https://github.com/cloudevents/sdk-javascript/blob/master/package.json) file
22-
in this repository. In the `standard-version.types` section, you can see all of the commit
23-
types that will be committed to the changelog based on the prefix in the first line of
24-
your commit message. For example, the commit message:
25-
26-
```log
27-
fix: removed a bug that was causing the rotation of the earth to change
28-
```
29-
30-
will show up in the "Bug Fixes" section of the changelog for a given release.
5+
We welcome contributions from the community! Please take some time to become
6+
acquainted with the process before submitting a pull request. There are just
7+
a few things to keep in mind.
318

329
## Pull Requests
3310

34-
Guidelines about how to perform pull requests.
11+
Typically a pull request should relate to an existing issue. If you have
12+
found a bug, want to add an improvement, or suggest an API change, please
13+
create an issue before proceeding with a pull request. For very minor changes
14+
such as typos in the documentation this isn't really necessary.
3515

36-
- before submit the PR, open an issue and link them
16+
For step by step help with managing your pull request, have a look at our
17+
[PR Guidelines](pr_guidelines.md) document.
3718

3819
### Commit Messages
3920

40-
Please follow the Conventional Commits specification noted above. the first line of
41-
your commit should be prefixed with a type, be a single sentence with no period, and
42-
succinctly indicate what this commit changes.
43-
44-
All commit message lines should be kept to fewer than 80 characters if possible.
45-
46-
### PR to `develop`
47-
48-
- fixes in the documentation (readme, contributors)
49-
- propose new files for the documentation
50-
- implementation of new features
21+
Please follow the
22+
[Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/#summary).
5123

52-
### PR to `master`
24+
### Sign your work
5325

54-
- hot fixes
26+
Each PR must be signed. Be sure your `git` `user.name` and `user.email` are configured
27+
then use the `--signoff` flag for your commits.
5528

56-
## Style Guide
29+
```console
30+
git commit --signoff
31+
```
5732

58-
_TODO_
33+
### Style Guide
5934

60-
### JavaScript Style Guide
35+
Code style for this module is maintained using [`eslint`](https://www.npmjs.com/package/eslint).
36+
When you run tests with `npm test` linting is performed first. If you want to
37+
check your code style for linting errors without running tests, you can just
38+
run `npm run lint`. If there are errors, you can usually fix them automatically
39+
by running `npm run fix`.
6140

62-
_TODO_
41+
Linting rules are declared in [.eslintrc](https://github.com/cloudevents/sdk-javascript/blob/master/.eslintrc).

maintainer_guidelines.md

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Maintainer's Guide
2+
3+
## Tips
4+
5+
Here are a few tips for repository maintainers.
6+
7+
* Stay on top of your pull requests. PRs that languish for too long can become difficult to merge.
8+
* Work from your own fork. As you are making contributions to the project, you should be working from your own fork just as outside contributors do. This keeps the branches in github to a minimum and reduces unnecessary CI runs.
9+
* Try to proactively label issues with backport labels if it's obvious that a change should be backported to previous releases.
10+
* When landing pull requests, if there is more than one commit, try to squash into a single commit. Usually this can just be done with the GitHub UI when merging the PR. Use "Squash and merge".
11+
* Triage issues once in a while in order to keep the repository alive. During the triage:
12+
* If some issues are stale for too long because they are no longer valid/relevant or because the discussion reached no significant action items to perform, close them and invite the users to reopen if they need it.
13+
* If some PRs are no longer valid but still needed, ask the user to rebase them
14+
* If some issues and PRs are still relevant, use labels to help organize tasks
15+
* If you find an issue that you want to create a fix for and submit a pull request, be sure to assign it to yourself so that others maintainers don't start working on it at the same time.
16+
17+
## Branch Management
18+
19+
The `master` branch is is the bleeding edge. New major versions of the module
20+
are cut from this branch and tagged. If you intend to submit a pull request
21+
you should use `master HEAD` as your starting point.
22+
23+
Each major release will result in a new branch and tag. For example, the
24+
release of version 1.0.0 of the module will result in a `v1.0.0` tag on the
25+
release commit, and a new branch `v1.x.y` for subsequent minor and patch
26+
level releases of that major version. However, development will continue
27+
apace on `master` for the next major version - e.g. 2.0.0. Version branches
28+
are only created for each major version. Minor and patch level releases
29+
are simply tagged.
30+

pr_guidelines.md

+176
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
# Pull Request Guidelines
2+
3+
Here you will find step by step guidance for creating, submitting and updating
4+
a pull request in this repository. We hope it will help you have an easy time
5+
managing your work and a positive, satisfying experience when contributing
6+
your code. Thanks for getting involved! :rocket:
7+
8+
* [Getting Started](#getting-started)
9+
* [Branches](#branches)
10+
* [Commit Messages](#commit-messages)
11+
* [Staying current with master](#staying-current-with-master)
12+
* [Style Guide](#style-guide)
13+
* [Submitting and Updating a Pull Request](#submitting-and-updating-a-pull-request)
14+
* [Congratulations!](#congratulations)
15+
16+
## Getting Started
17+
18+
When creating a pull request, first fork this repository and clone it to your
19+
local development environment. Then add this repository as the upstream.
20+
21+
```console
22+
git clone https://github.com/mygithuborg/sdk-javascript.git
23+
cd sdk-javascript
24+
git remote add upstream https://github.com/cloudevents/sdk-javascript.git
25+
```
26+
27+
## Branches
28+
29+
The first thing you'll need to do is create a branch for your work.
30+
If you are submitting a pull request that fixes or relates to an existing
31+
GitHub issue, you can use this in your branch name to keep things organized.
32+
For example, if you were to create a pull request to fix
33+
[this error with `httpAgent`](https://github.com/cloudevents/sdk-javascript/issues/48)
34+
you might create a branch named `48-fix-http-agent-error`.
35+
36+
```console
37+
git fetch upstream
38+
git reset --hard upstream/master
39+
git checkout -b 48-fix-http-agent-error
40+
```
41+
42+
## Commit Messages
43+
44+
Please follow the
45+
[Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/#summary).
46+
The first line of your commit should be prefixed with a type, be a single
47+
sentence with no period, and succinctly indicate what this commit changes.
48+
49+
All commit message lines should be kept to fewer than 80 characters if possible.
50+
51+
An example of a good commit message.
52+
53+
```log
54+
docs: remove 0.1, 0.2 spec support from README
55+
```
56+
57+
If you are unsure what prefix to use for a commit, you can consult the
58+
[package.json](package.json) file.
59+
In the `standard-version.types` section, you can see all of the commit
60+
types that will be committed to the changelog based on the prefix in the first line of
61+
your commit message. For example, the commit message:
62+
63+
```log
64+
fix: removed a bug that was causing the rotation of the earth to change
65+
```
66+
67+
will show up in the "Bug Fixes" section of the changelog for a given release.
68+
69+
### Signing your commits
70+
71+
Each commit must be signed. Use the `--signoff` flag for your commits.
72+
73+
```console
74+
git commit --signoff
75+
```
76+
77+
This will add a line to every git commit message:
78+
79+
Signed-off-by: Joe Smith <joe.smith@email.com>
80+
81+
Use your real name (sorry, no pseudonyms or anonymous contributions.)
82+
83+
The sign-off is a signature line at the end of your commit message. Your
84+
signature certifies that you wrote the patch or otherwise have the right to pass
85+
it on as open-source code. See [developercertificate.org](http://developercertificate.org/))
86+
for the full text of the certification.
87+
88+
Be sure to have your `user.name` and `user.email` set in your git config.
89+
If your git config information is set properly then viewing the `git log`
90+
information for your commit will look something like this:
91+
92+
```
93+
Author: Joe Smith <joe.smith@email.com>
94+
Date: Thu Feb 2 11:41:15 2018 -0800
95+
96+
Update README
97+
98+
Signed-off-by: Joe Smith <joe.smith@email.com>
99+
```
100+
101+
Notice the `Author` and `Signed-off-by` lines match. If they don't your PR will
102+
be rejected by the automated DCO check.
103+
104+
## Staying Current with `master`
105+
106+
As you are working on your branch, changes may happen on `master`. Before
107+
submitting your pull request, be sure that your branch has been updated
108+
with the latest commits.
109+
110+
```console
111+
git fetch upstream
112+
git rebase upstream/master
113+
```
114+
115+
This may cause conflicts if the files you are changing on your branch are
116+
also changed on master. Error messages from `git` will indicate if conflicts
117+
exist and what files need attention. Resolve the conflicts in each file, then
118+
continue with the rebase with `git rebase --continue`.
119+
120+
121+
If you've already pushed some changes to your `origin` fork, you'll
122+
need to force push these changes.
123+
124+
```console
125+
git push -f origin 48-fix-http-agent-error
126+
```
127+
128+
## Style Guide
129+
130+
Code style for this module is maintained using [`eslint`](https://www.npmjs.com/package/eslint).
131+
When you run tests with `npm test` linting is performed first. If you want to
132+
check your code style for linting errors without running tests, you can just
133+
run `npm run lint`. If there are errors, you can usually fix them automatically
134+
by running `npm run fix`.
135+
136+
Linting rules are declared in [.eslintrc](https://github.com/cloudevents/sdk-javascript/blob/master/.eslintrc).
137+
138+
## Submitting and Updating Your Pull Request
139+
140+
Before submitting a pull request, you should make sure that all of the tests
141+
successfully pass by running `npm test`.
142+
143+
Once you have sent your pull request, `master` may continue to evolve
144+
before your pull request has landed. If there are any commits on `master`
145+
that conflict with your changes, you may need to update your branch with
146+
these changes before the pull request can land. Resolve conflicts the same
147+
way as before.
148+
149+
```console
150+
git fetch upstream
151+
git rebase upstream/master
152+
# fix any potential conflicts
153+
git push -f origin 48-fix-http-agent-error
154+
```
155+
156+
This will cause the pull request to be updated with your changes, and
157+
CI will rerun.
158+
159+
A maintainer may ask you to make changes to your pull request. Sometimes these
160+
changes are minor and shouldn't appear in the commit log. For example, you may
161+
have a typo in one of your code comments that should be fixed before merge.
162+
You can prevent this from adding noise to the commit log with an interactive
163+
rebase. See the [git documentation](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)
164+
for details.
165+
166+
```console
167+
git commit -m "fixup: fix typo"
168+
git rebase -i upstream/master # follow git instructions
169+
```
170+
171+
Once you have rebased your commits, you can force push to your fork as before.
172+
173+
## Congratulations!
174+
175+
Congratulations! You've done it! We really appreciate the time and energy
176+
you've given to the project. Thank you.

0 commit comments

Comments
 (0)