|
| 1 | +<!-- Generated by npm init @grpn --> |
| 2 | + |
| 3 | +# Contributing |
| 4 | + |
| 5 | +🎉🏅 Thanks for helping us improve this project! 🙏 |
| 6 | + |
| 7 | +This document outlines some practices we care about. |
| 8 | +If you have any questions or suggestions about the process, |
| 9 | +feel free to [open an issue](#reporting-issues) |
| 10 | +. |
| 11 | + |
| 12 | +## How Can I Contribute? |
| 13 | + |
| 14 | +### Reporting Issues |
| 15 | + |
| 16 | +If you find any mistakes in the docs or a bug in the code, |
| 17 | +please [open an issue in Github](https://github.com/groupon/gh-bulk-pr/issues/new) so we can look into it. |
| 18 | +You can also [create a PR](#contributing-code) fixing it yourself, or course. |
| 19 | + |
| 20 | +If you report a bug, please follow these guidelines: |
| 21 | + |
| 22 | +* Make sure the bug exists in the latest version. |
| 23 | +* Include instructions on how to reproduce the issue. |
| 24 | + The instructions should be as minimal as possible |
| 25 | + and answer the three big questions: |
| 26 | + 1. What are the exact steps you took? This includes the exact versions of |
| 27 | + node, npm, and any packages involved. |
| 28 | + 1. What result are you expecting? |
| 29 | + 1. What is the actual result? |
| 30 | + |
| 31 | +### Improving Documentation |
| 32 | + |
| 33 | +For small documentation changes, you can use [Github's editing feature][ghedit]. |
| 34 | +The only thing to keep in mind is to prefix the commit message with "docs: ". |
| 35 | +The default commit message generated by Github will lead to a failing CI build. |
| 36 | + |
| 37 | +[ghedit]: https://help.github.com/articles/editing-files-in-another-user-s-repository/ |
| 38 | + |
| 39 | +For larger updates to the documentation |
| 40 | +it might be better to follow the |
| 41 | +[instructions for contributing code below](#contributing-code). |
| 42 | + |
| 43 | +### Contributing Code |
| 44 | + |
| 45 | +**Note:** If you're planning on making substantial changes, |
| 46 | +please [open an issue first to discuss your idea](#reporting-issues). |
| 47 | +Otherwise, you might end up investing a lot of work |
| 48 | +only to discover that it conflicts with plans the maintainers might have. |
| 49 | + |
| 50 | +The general steps for creating a pull request are: |
| 51 | + |
| 52 | +1. Create a branch for your change. Always start your branch from the latest default branch. |
| 53 | + We recommend using `git wf start some-feature-name` by using |
| 54 | + [git workflow][gitwf]. Run `npm install` to install the dependencies. |
| 55 | +1. If you're fixing a bug, be sure to write a test *first*. That way you can |
| 56 | + validate that the test actually catches the bug and doesn't pass. |
| 57 | +1. Make your changes to the code. Remember to update the tests if you add new |
| 58 | + features or change behavior. |
| 59 | +1. Run the tests via `npm test`. This will also run style checks and other |
| 60 | + validations. You might see errors about uncommitted files. This is |
| 61 | + expected until you commit your changes. |
| 62 | +1. Once you're done, `git add .` and `git commit`. Please follow the |
| 63 | + [commit message conventions](#commits--commit-messages) described below. |
| 64 | +1. Push your branch to Github & create a PR. |
| 65 | + |
| 66 | +[gitwf]: https://github.com/groupon/git-workflow |
| 67 | + |
| 68 | +#### Code Style |
| 69 | + |
| 70 | +In addition to any linting rules the project might include, a few general rules |
| 71 | +of thumb: |
| 72 | + |
| 73 | +* Try to match the style of the rest of the code. |
| 74 | +* We prefer simple code that is easy to understand over terse, expressive code. |
| 75 | +* We try to structure projects by semantics instead of role. E.g. we'd rather |
| 76 | + have a `tree.js` module that contains tree traversal-related helpers than |
| 77 | + a `helpers.js` module. |
| 78 | +* Actually, if you create helpers you might want to put those into a separate |
| 79 | + package. That way it's easier to reuse them. |
| 80 | + |
| 81 | +#### Commits & Commit Messages |
| 82 | + |
| 83 | +Please follow the [angular commit message conventions][angular-commits]. We |
| 84 | +use an automated tool for generating releases that depends on the conventions |
| 85 | +to determine the next version and the content of the changelog. Commit messages |
| 86 | +that don't follow the conventions will cause `npm test` (and thus CI) to fail. |
| 87 | + |
| 88 | +The short summary - a commit message should look like this: |
| 89 | + |
| 90 | +``` |
| 91 | +<type>(<scope>): <subject> |
| 92 | +<BLANK LINE> |
| 93 | +<body> |
| 94 | +<BLANK LINE> |
| 95 | +<references> |
| 96 | +<BLANK LINE> |
| 97 | +<footer> |
| 98 | +``` |
| 99 | + |
| 100 | +Everything but the first line is optional. |
| 101 | +The empty lines between the different parts are required. |
| 102 | + |
| 103 | +* `<type>`: One of the following: |
| 104 | + |
| 105 | +|`<type>`| Explanation | Version change | |
| 106 | +| :----- | :---------- | :-------------: | |
| 107 | +| **feat** | 🚀 Introduces a new feature | minor | |
| 108 | +|| |
| 109 | +| **fix** | 🐛 A bug fix | patch | |
| 110 | +| **perf** | ⚡ Performance optimizations| patch | |
| 111 | +| **refactor** | 📦️ Changes to the code structure without fixing bugs or adding features | patch | |
| 112 | +| **chore** | 🏡 Changes to the project setup and tools, dependency bumps, house-keeping | patch | |
| 113 | +| **build** | 🏡 Changes that affect the build system (e.g webpack, rollup, ...) | patch | |
| 114 | +| **revert** | ↩️ reverts a previous commit | patch | |
| 115 | +|| |
| 116 | +| **docs** | 📝 Changes to the documentation | none | |
| 117 | +| **style** | 💅 Cleanup & lint rule fixes. Note that often it's better to just amend the previous commit if it introduced lint errors | none | |
| 118 | +| **test** | 🧪 Fixing existing tests or adding missing ones. Just like with **style**, if you add tests to a feature you just introduced in the previous commit, consider keeping the tests, and the feature in the same commit instead. | none | |
| 119 | +| **ci** | 🏡 Changes to your CI configuration & scripts | none | |
| 120 | +* `<subject>`: A [good git commit message subject](http://chris.beams.io/posts/git-commit/#limit-50). |
| 121 | + - Keep it brief. If possible the whole first line should have at most 50 characters. |
| 122 | + - Use an imperative mood. "Create" instead of "creates" or "created". |
| 123 | + - No period (".") at the end. |
| 124 | +* `<body>`: Motivation for the change and any context required for understanding the choices made. |
| 125 | + Just like the subject, it should use an imperative mood. |
| 126 | +* `<scope>`: The scope is optional and specifies the place of your commit. Use `*` for multiple places. |
| 127 | +* `<references>`: Any URLs relevant to the PR go here. |
| 128 | + Use one line per URL and prefix it with the kind of relationship, e.g. "Closes: " or "See: ". |
| 129 | + If you are referencing an issue in your commit body or PR description, |
| 130 | + never use `#123` but the full URL to the issue or PR you are referencing. |
| 131 | + That way the reference is easy to resolve from the git history without having to "guess" the correct link |
| 132 | + even if the commit got cherry-picked or merged into a different project. |
| 133 | +* `<footer>`: This part only applies if your commit introduces a breaking change. |
| 134 | + It's important this is present, otherwise the **major version** will not increase. |
| 135 | + See below for an example. |
| 136 | + |
| 137 | +[angular-commits]: https://github.com/angular/angular.js/blob/9bff2ce8fb170d7a33d3ad551922d7e23e9f82fc/DEVELOPERS.md#commit-message-format |
| 138 | + |
| 139 | +##### Examples |
| 140 | + |
| 141 | +A feature that introduces a breaking change: |
| 142 | + |
| 143 | +``` |
| 144 | +feat: Support --yes CLI option |
| 145 | +
|
| 146 | +For existing projects all prompts can be inferred automatically. |
| 147 | +Manual confirmation for each default provides no value in that case. |
| 148 | +
|
| 149 | +Closes https://github.com/my/project/issues/123 |
| 150 | +
|
| 151 | +BREAKING CHANGE: This removes support for interactive password entry. |
| 152 | +Users will have to login beforehand. |
| 153 | +``` |
| 154 | + |
| 155 | +A simple bug fix: |
| 156 | + |
| 157 | +``` |
| 158 | +fix: Handle multi-byte characters in search logic |
| 159 | +``` |
| 160 | + |
0 commit comments