Skip to content

Commit 13f2c0c

Browse files
committed
docs: add instructions and details to contributors guide
Signed-off-by: Lance Ball <[email protected]>
1 parent e83db29 commit 13f2c0c

File tree

1 file changed

+126
-31
lines changed

1 file changed

+126
-31
lines changed

CONTRIBUTING.md

Lines changed: 126 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,87 @@
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.
5+
We welcome contributions from the community! Please take some time to become
6+
acquainted with the process before submitting a pull request.
77

8-
## Branch Management
8+
## Pull Requests
99

10-
We use Gitflow to manage our branches and that's ok when `develop` branch is
11-
ahead of `master`.
10+
When creating a pull request, first fork this repository and clone it to your
11+
local development environment. Then add this repository as the upstream.
1212

13-
- [Gitflow](https://nvie.com/posts/a-successful-git-branching-model/) by @nvie
13+
```console
14+
git clone https://github.com/mygithuborg/sdk-javascript.git
15+
git remote add upstream https://github.com/cloudevents/sdk-javascript.git
16+
```
1417

15-
## Changelog
18+
Typically a pull request should relate to an existing issue. If you have
19+
found a bug, want to add an improvement, or suggest an API change, please
20+
create an issue before proceeding with a pull request. For very minor changes
21+
such as typos in the documentation this isn't really necessary.
22+
23+
Create a branch for your work. If you are submitting a pull request that
24+
fixes or relates to an existing GitHub issue, you can use this in your
25+
branch name to keep things organized. For example, if you were to create
26+
a pull request to fix
27+
[this error with `httpAgent`](https://github.com/cloudevents/sdk-javascript/issues/48)
28+
you might create a branch named `48-fix-http-agent-error`.
29+
30+
```console
31+
git fetch upstream
32+
git reset --hard upstream/master
33+
git co -b 48-fix-http-agent-error
34+
```
1635

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:
36+
As you are working on your branch, changes may happen on `master`. Before
37+
submitting your pull request, be sure that your branch has been updated
38+
with the latest commits on `master`.
2539

26-
```log
27-
fix: removed a bug that was causing the rotation of the earth to change
40+
```console
41+
git rebase upstream/master
2842
```
2943

30-
will show up in the "Bug Fixes" section of the changelog for a given release.
44+
This may cause conflicts if the files you are changing on your branch are
45+
also changed on master. Follow the `git` error messages to resolve these.
46+
If you've already pushed some changes to your `origin` fork, you'll
47+
need to force push these changes.
3148

32-
## Pull Requests
49+
```console
50+
git push -f origin 48-fix-http-agent-error
51+
```
52+
53+
Once you have submitted your pull request, `master` may continue to evolve
54+
before your pull request has landed. If there are any commits on `master`
55+
that conflict with your changes, you may need to update your branch with
56+
these changes before the pull request can land.
57+
58+
```console
59+
git fetch upstream
60+
git rebase upstream/master
61+
# fix any potential conflicts
62+
git push -f origin 48-fix-http-agent-error
63+
```
64+
65+
This will cause the pull request to be updated with your changes, and
66+
CI will rerun.
67+
68+
### Updating Your Pull Request
69+
70+
A maintainer may ask you to make changes to your pull request. Sometimes these
71+
changes are minor and shouldn't appear in the commit log. For example, you may
72+
have a typo in one of your code comments that should be fixed before merge.
73+
You can prevent this from adding noise to the commit log with an interactive
74+
rebase. See the [git documentation](https://git-scm.com/book/en/v2/Git-Tools-Rewriting-History)
75+
for details.
76+
77+
```console
78+
git commit -m "fixup: fix typo"
79+
git rebase -i upstream/master # follow git instructions
80+
```
3381

34-
Guidelines about how to perform pull requests.
82+
Once you have rebased your commits, you can force push to your fork as before.
83+
In most cases, there should only be a single commit in a pull request.
3584

36-
- before submit the PR, open an issue and link them
85+
**NB: Be sure you have run all tests before submitting your pull request.**
3786

3887
### Commit Messages
3988

@@ -43,20 +92,66 @@ succinctly indicate what this commit changes.
4392

4493
All commit message lines should be kept to fewer than 80 characters if possible.
4594

46-
### PR to `develop`
95+
## Style Guide
4796

48-
- fixes in the documentation (readme, contributors)
49-
- propose new files for the documentation
50-
- implementation of new features
97+
Code style for this module is maintained using [`eslint`](https://www.npmjs.com/package/eslint).
98+
When you run tests with `npm test` linting is performed first. If you want to
99+
check your code style for linting errors without running tests, you can just
100+
run `npm run lint`. If there are errors, you can usually fix them automatically
101+
by running `npm run fix`.
51102

52-
### PR to `master`
103+
Linting rules are declared in [.eslintrc](https://github.com/cloudevents/sdk-javascript/blob/master/.eslintrc).
53104

54-
- hot fixes
55105

56-
## Style Guide
106+
## Branch Management
107+
108+
The `master` branch is is the bleeding edge. New major versions of the module
109+
are cut from this branch and tagged. If you intend to submit a pull request
110+
you should use `master HEAD` as your starting point.
111+
112+
Each major release will result in a new branch and tag. For example, the
113+
release of version 1.0.0 of the module will result in a `v1.0.0` tag on the
114+
release commit, and a new branch `v1.x.y` for subsequent minor and patch
115+
level releases of that major version. However, development will continue
116+
apace on `master` for the next major version - e.g. 2.0.0. Version branches
117+
are only created for each major version. Minor and patch level releases
118+
are simply tagged on the major version branch.
119+
120+
If there is a change on `master` that should be backported to a previous version,
121+
the pull request for that change should be labeled with the `v1.x.y-backport`
122+
label. When it comes time to release a minor or patch level version of a
123+
previous release, the commits in these labeled pull requests will be cherry
124+
picked and backported to the `v1.x.y` branch, for example, and a new tag is
125+
applied, e.g. `v1.1.0`.
126+
127+
** NB Most of these tasks are handled by maintainers. Community contributors
128+
will typically not need to worry about all of this. **
129+
130+
## Changelog
131+
132+
The [CHANGELOG.md](./CHANGELOG.md) will be updated with your commits if you format
133+
your commit messages following the
134+
[Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/#summary).
135+
If you are unsure what prefix to use for a commit, you can consult the
136+
[package.json](https://github.com/cloudevents/sdk-javascript/blob/master/package.json) file
137+
in this repository. In the `standard-version.types` section, you can see all of the commit
138+
types that will be committed to the changelog based on the prefix in the first line of
139+
your commit message. For example, the commit message:
140+
141+
```log
142+
fix: removed a bug that was causing the rotation of the earth to change
143+
```
144+
145+
will show up in the "Bug Fixes" section of the changelog for a given release.
57146

58-
_TODO_
147+
## Maintainer's Guide
59148

60-
### JavaScript Style Guide
149+
Here are a few tips for repository maintainers.
61150

62-
_TODO_
151+
* Stay on top of your pull requests. PRs that languish for too long can become
152+
difficult to merge.
153+
* Work from your own fork. As you are making contributions to the project, you
154+
should be working from your own fork just as outside contributors do. This
155+
keeps the branches in github to a minimum and reduces unnecessary CI runs.
156+
* Try to proactively label issues with backport labels if it's obvious that a
157+
change should be backported to previous releases.

0 commit comments

Comments
 (0)