|
2 | 2 |
|
3 | 3 | :+1::tada: First off, thanks for taking the time to contribute! :tada::+1:
|
4 | 4 |
|
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. |
7 | 7 |
|
8 |
| -## Branch Management |
| 8 | +## Pull Requests |
9 | 9 |
|
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. |
12 | 12 |
|
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 | +``` |
14 | 17 |
|
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 | +``` |
16 | 35 |
|
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`. |
25 | 39 |
|
26 |
| -```log |
27 |
| -fix: removed a bug that was causing the rotation of the earth to change |
| 40 | +```console |
| 41 | +git rebase upstream/master |
28 | 42 | ```
|
29 | 43 |
|
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. |
31 | 48 |
|
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 | +``` |
33 | 64 |
|
34 |
| -Guidelines about how to perform pull requests. |
| 65 | +This will cause the pull request to be updated with your changes, and |
| 66 | +CI will rerun. |
35 | 67 |
|
36 |
| -- before submit the PR, open an issue and link them |
| 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 | +``` |
| 81 | + |
| 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. |
| 84 | + |
| 85 | +**NB: Be sure you have run all tests before submitting your pull request.** |
37 | 86 |
|
38 | 87 | ### Commit Messages
|
39 | 88 |
|
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. |
| 89 | +Please follow the |
| 90 | +[Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/#summary). |
| 91 | +The first line of your commit should be prefixed with a type, be a single |
| 92 | +sentence with no period, and succinctly indicate what this commit changes. |
43 | 93 |
|
44 | 94 | All commit message lines should be kept to fewer than 80 characters if possible.
|
45 | 95 |
|
46 |
| -### PR to `develop` |
| 96 | +An example of a good commit message. |
47 | 97 |
|
48 |
| -- fixes in the documentation (readme, contributors) |
49 |
| -- propose new files for the documentation |
50 |
| -- implementation of new features |
| 98 | +```log |
| 99 | +docs: remove 0.1, 0.2 spec support from README |
| 100 | +``` |
| 101 | + |
| 102 | +## Style Guide |
51 | 103 |
|
52 |
| -### PR to `master` |
| 104 | +Code style for this module is maintained using [`eslint`](https://www.npmjs.com/package/eslint). |
| 105 | +When you run tests with `npm test` linting is performed first. If you want to |
| 106 | +check your code style for linting errors without running tests, you can just |
| 107 | +run `npm run lint`. If there are errors, you can usually fix them automatically |
| 108 | +by running `npm run fix`. |
53 | 109 |
|
54 |
| -- hot fixes |
| 110 | +Linting rules are declared in [.eslintrc](https://github.com/cloudevents/sdk-javascript/blob/master/.eslintrc). |
55 | 111 |
|
56 |
| -## Style Guide |
57 | 112 |
|
58 |
| -_TODO_ |
| 113 | +## Branch Management |
| 114 | + |
| 115 | +The `master` branch is is the bleeding edge. New major versions of the module |
| 116 | +are cut from this branch and tagged. If you intend to submit a pull request |
| 117 | +you should use `master HEAD` as your starting point. |
| 118 | + |
| 119 | +Each major release will result in a new branch and tag. For example, the |
| 120 | +release of version 1.0.0 of the module will result in a `v1.0.0` tag on the |
| 121 | +release commit, and a new branch `v1.x.y` for subsequent minor and patch |
| 122 | +level releases of that major version. However, development will continue |
| 123 | +apace on `master` for the next major version - e.g. 2.0.0. Version branches |
| 124 | +are only created for each major version. Minor and patch level releases |
| 125 | +are simply tagged on the major version branch. |
| 126 | + |
| 127 | +If there is a change on `master` that should be backported to a previous version, |
| 128 | +the pull request for that change should be labeled with the `v1.x.y-backport` |
| 129 | +label. When it comes time to release a minor or patch level version of a |
| 130 | +previous release, the commits in these labeled pull requests will be cherry |
| 131 | +picked and backported to the `v1.x.y` branch, for example, and a new tag is |
| 132 | +applied, e.g. `v1.1.0`. |
| 133 | + |
| 134 | +** NB Most of these tasks are handled by maintainers. Community contributors |
| 135 | +will typically not need to worry about all of this. ** |
| 136 | + |
| 137 | +## Changelog |
| 138 | + |
| 139 | +The [CHANGELOG.md](./CHANGELOG.md) will be updated with your commits if you format |
| 140 | +your commit messages following the |
| 141 | +[Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/#summary). |
| 142 | +If you are unsure what prefix to use for a commit, you can consult the |
| 143 | +[package.json](https://github.com/cloudevents/sdk-javascript/blob/master/package.json) file |
| 144 | +in this repository. In the `standard-version.types` section, you can see all of the commit |
| 145 | +types that will be committed to the changelog based on the prefix in the first line of |
| 146 | +your commit message. For example, the commit message: |
| 147 | + |
| 148 | +```log |
| 149 | +fix: removed a bug that was causing the rotation of the earth to change |
| 150 | +``` |
| 151 | + |
| 152 | +will show up in the "Bug Fixes" section of the changelog for a given release. |
| 153 | + |
| 154 | +## Maintainer's Guide |
59 | 155 |
|
60 |
| -### JavaScript Style Guide |
| 156 | +Here are a few tips for repository maintainers. |
61 | 157 |
|
62 |
| -_TODO_ |
| 158 | +* Stay on top of your pull requests. PRs that languish for too long can become |
| 159 | +difficult to merge. |
| 160 | +* Work from your own fork. As you are making contributions to the project, you |
| 161 | +should be working from your own fork just as outside contributors do. This |
| 162 | +keeps the branches in github to a minimum and reduces unnecessary CI runs. |
| 163 | +* Try to proactively label issues with backport labels if it's obvious that a |
| 164 | +change should be backported to previous releases. |
0 commit comments