|
| 1 | +# Contributing to vue-i18next |
| 2 | + |
| 3 | +✨ Thanks for contributing to **vue-i18next**! ✨ |
| 4 | + |
| 5 | +As a contributor, here are the guidelines we would like you to follow: |
| 6 | +- [Code of conduct](#code-of-conduct) |
| 7 | +- [How can I contribute?](#how-can-i-contribute) |
| 8 | +- [Using the issue tracker](#using-the-issue-tracker) |
| 9 | +- [Submitting a Pull Request](#submitting-a-pull-request) |
| 10 | +- [Coding rules](#coding-rules) |
| 11 | +- [Working with the code](#working-with-the-code) |
| 12 | + |
| 13 | +We also recommend that you read [How to Contribute to Open Source](https://opensource.guide/how-to-contribute). |
| 14 | + |
| 15 | +## Code of conduct |
| 16 | + |
| 17 | +Help us keep **vue-i18next** open and inclusive. Please read and follow our [Code of conduct](CODE_OF_CONDUCT.md). |
| 18 | + |
| 19 | +## How can I contribute? |
| 20 | + |
| 21 | +### Improve documentation |
| 22 | + |
| 23 | +As a **vue-i18next** user, you are the perfect candidate to help us improve our documentation: typo corrections, clarifications, more examples, etc. |
| 24 | + |
| 25 | +### Give feedback on issues |
| 26 | + |
| 27 | +Some issues are created without information requested in the [Bug report guideline](#bug-report). Help make them easier to resolve by adding any relevant information. |
| 28 | + |
| 29 | +### Fix bugs and implement features |
| 30 | + |
| 31 | +Confirmed bugs and ready-to-implement features are marked with the [help wanted label](https://github.com/panter/vue-i18next/labels/help%20wanted). Post a comment on an issue to indicate you would like to work on it and to request help from the maintainers and the community. |
| 32 | + |
| 33 | +## Using the issue tracker |
| 34 | + |
| 35 | +The issue tracker is the channel for [bug reports](#bug-report), [features requests](#feature-request) and [submitting pull requests](#submitting-a-pull-request) only. Please use the [Support](docs/support/README.md) and [Get help](README.md#get-help) sections for support, troubleshooting and questions. |
| 36 | + |
| 37 | +Before opening an issue or a Pull Request, please use the GitHub issue search to make sure the bug or feature request hasn't been already reported or fixed. |
| 38 | + |
| 39 | +### Bug report |
| 40 | + |
| 41 | +A good bug report shouldn't leave others needing to chase you for more information. Please try to be as detailed as possible in your report and fill the information requested in the [Bug report template](https://github.com/semantic-release/semantic-release/issues/new?template=bug-report.md). |
| 42 | + |
| 43 | +### Feature request |
| 44 | + |
| 45 | +Feature requests are welcome, but take a moment to find out whether your idea fits with the scope and aims of the project. It's up to you to make a strong case to convince the project's developers of the merits of this feature. Please provide as much detail and context as possible and fill the information requested in the [Feature request template](https://github.com/semantic-release/semantic-release/issues/new?template=feature-request.md). |
| 46 | + |
| 47 | +## Submitting a Pull Request |
| 48 | + |
| 49 | +Good pull requests, whether patches, improvements, or new features, are a fantastic help. They should remain focused in scope and avoid containing unrelated commits. |
| 50 | + |
| 51 | +1. [Set up the workspace](#set-up-the-workspace) |
| 52 | +2. If you cloned a while ago, get the latest changes from upstream and update dependencies: |
| 53 | +```bash |
| 54 | +$ git checkout master |
| 55 | +$ git pull upstream master |
| 56 | +$ rm -rf node_modules |
| 57 | +$ npm install |
| 58 | +``` |
| 59 | +3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix: |
| 60 | +```bash |
| 61 | +$ git checkout -b <topic-branch-name> |
| 62 | +``` |
| 63 | +4. Make your code changes, following the [Coding rules](#coding-rules) |
| 64 | +5. Push your topic branch up to your fork: |
| 65 | +```bash |
| 66 | +$ git push origin <topic-branch-name> |
| 67 | +``` |
| 68 | +6. [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request/#creating-the-pull-request) with a clear title and description. |
| 69 | + |
| 70 | +**Please ask first** before embarking on any significant pull requests (e.g. implementing features, refactoring code), otherwise you risk spending a lot of time working on something that the project's developers might not want to merge into the project. |
| 71 | + |
| 72 | +If you have never created a pull request before, welcome 🎉 😄. [Here is a great tutorial](https://opensource.guide/how-to-contribute/#opening-a-pull-request) on how to send one :) |
| 73 | + |
| 74 | +Here is a summary of the steps to follow: |
| 75 | + |
| 76 | +1. [Set up the workspace](#set-up-the-workspace) |
| 77 | +2. If you cloned a while ago, get the latest changes from upstream and update dependencies: |
| 78 | +```bash |
| 79 | +$ git checkout master |
| 80 | +$ git pull upstream master |
| 81 | +$ rm -rf node_modules |
| 82 | +$ npm install |
| 83 | +``` |
| 84 | +3. Create a new topic branch (off the main project development branch) to contain your feature, change, or fix: |
| 85 | +```bash |
| 86 | +$ git checkout -b <topic-branch-name> |
| 87 | +``` |
| 88 | +4. Make your code changes, following the [Coding rules](#coding-rules) |
| 89 | +5. Push your topic branch up to your fork: |
| 90 | +```bash |
| 91 | +$ git push origin <topic-branch-name> |
| 92 | +``` |
| 93 | +6. [Open a Pull Request](https://help.github.com/articles/creating-a-pull-request/#creating-the-pull-request) with a clear title and description. |
| 94 | + |
| 95 | +**Tips**: |
| 96 | +- For ambitious tasks, open a Pull Request as soon as possible with the `[WIP]` prefix in the title, in order to get feedback and help from the community. |
| 97 | +- [Allow semantic-release maintainers to make changes to your Pull Request branch](https://help.github.com/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork). This way, we can rebase it and make some minor changes if necessary. All changes we make will be done in new commit and we'll ask for your approval before merging them. |
| 98 | + |
| 99 | +## Coding rules |
| 100 | + |
| 101 | +### Source code |
| 102 | + |
| 103 | +To ensure consistency and quality throughout the source code, all code modifications must have: |
| 104 | +- No [linting](#lint) errors |
| 105 | +- A [test](#tests) for every possible case introduced by your code change |
| 106 | +- **100%** test coverage |
| 107 | +- [Valid commit message(s)](#commit-message-guidelines) |
| 108 | +- Documentation for new features |
| 109 | +- Updated documentation for modified features |
| 110 | + |
| 111 | +### Commit message guidelines |
| 112 | + |
| 113 | +#### Atomic commits |
| 114 | + |
| 115 | +If possible, make [atomic commits](https://en.wikipedia.org/wiki/Atomic_commit), which means: |
| 116 | +- a commit should contain exactly one self-contained functional change |
| 117 | +- a functional change should be contained in exactly one commit |
| 118 | +- a commit should not create an inconsistent state (such as test errors, linting errors, partial fix, feature with documentation etc...) |
| 119 | + |
| 120 | +A complex feature can be broken down into multiple commits as long as each one maintains a consistent state and consists of a self-contained change. |
| 121 | + |
| 122 | +#### Commit message format |
| 123 | + |
| 124 | +Each commit message consists of a **header**, a **body** and a **footer**. The header has a special format that includes a **type**, a **scope** and a **subject**: |
| 125 | + |
| 126 | +```commit |
| 127 | +<type>(<scope>): <subject> |
| 128 | +<BLANK LINE> |
| 129 | +<body> |
| 130 | +<BLANK LINE> |
| 131 | +<footer> |
| 132 | +``` |
| 133 | + |
| 134 | +The **header** is mandatory and the **scope** of the header is optional. |
| 135 | + |
| 136 | +The **footer** can contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages). |
| 137 | + |
| 138 | +#### Revert |
| 139 | + |
| 140 | +If the commit reverts a previous commit, it should begin with `revert: `, followed by the header of the reverted commit. In the body it should say: `This reverts commit <hash>.`, where the hash is the SHA of the commit being reverted. |
| 141 | + |
| 142 | +#### Type |
| 143 | + |
| 144 | +The type must be one of the following: |
| 145 | + |
| 146 | +| Type | Description | |
| 147 | +|--------------|-------------------------------------------------------------------------------------------------------------| |
| 148 | +| **build** | Changes that affect the build system or external dependencies (example scopes: gulp, broccoli, npm) | |
| 149 | +| **ci** | Changes to our CI configuration files and scripts (example scopes: Travis, Circle, BrowserStack, SauceLabs) | |
| 150 | +| **docs** | Documentation only changes | |
| 151 | +| **feat** | A new feature | |
| 152 | +| **fix** | A bug fix | |
| 153 | +| **perf** | A code change that improves performance | |
| 154 | +| **refactor** | A code change that neither fixes a bug nor adds a feature | |
| 155 | +| **style** | Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc) | |
| 156 | +| **test** | Adding missing tests or correcting existing tests | |
| 157 | + |
| 158 | +#### Subject |
| 159 | + |
| 160 | +The subject contains succinct description of the change: |
| 161 | + |
| 162 | +- use the imperative, present tense: "change" not "changed" nor "changes" |
| 163 | +- don't capitalize first letter |
| 164 | +- no dot (.) at the end |
| 165 | + |
| 166 | +#### Body |
| 167 | +Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes". |
| 168 | +The body should include the motivation for the change and contrast this with previous behavior. |
| 169 | + |
| 170 | +#### Footer |
| 171 | +The footer should contain any information about **Breaking Changes** and is also the place to reference GitHub issues that this commit **Closes**. |
| 172 | + |
| 173 | +**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. The rest of the commit message is then used for this. |
| 174 | + |
| 175 | +#### Examples |
| 176 | + |
| 177 | +```commit |
| 178 | +`fix(pencil): stop graphite breaking when too much pressure applied` |
| 179 | +``` |
| 180 | + |
| 181 | +```commit |
| 182 | +`feat(pencil): add 'graphiteWidth' option` |
| 183 | +
|
| 184 | +Fix #42 |
| 185 | +``` |
| 186 | + |
| 187 | +```commit |
| 188 | +perf(pencil): remove graphiteWidth option` |
| 189 | +
|
| 190 | +BREAKING CHANGE: The graphiteWidth option has been removed. |
| 191 | +
|
| 192 | +The default graphite width of 10mm is always used for performance reasons. |
| 193 | +``` |
| 194 | + |
| 195 | +## Working with the code |
| 196 | + |
| 197 | +### Set up the workspace |
| 198 | + |
| 199 | +[Fork](https://guides.github.com/activities/forking/#fork) the project, [clone](https://guides.github.com/activities/forking/#clone) your fork, configure the remotes and install the dependencies: |
| 200 | + |
| 201 | +```bash |
| 202 | +# Clone your fork of the repo into the current directory |
| 203 | +$ git clone https://github.com/@panter/vue-i18next |
| 204 | +# Navigate to the newly cloned directory |
| 205 | +$ cd <repo-name> |
| 206 | +# Assign the original repo to a remote called "upstream" |
| 207 | +$ git remote add upstream https://github.com/@panter/vue-i18next |
| 208 | +# Install the dependencies |
| 209 | +$ npm install |
| 210 | +``` |
| 211 | + |
| 212 | +### Tests |
| 213 | + |
| 214 | +Before pushing your code changes make sure all **tests pass** and the **coverage is ~100%**: |
| 215 | + |
| 216 | +```bash |
| 217 | +$ npm run test |
| 218 | +``` |
0 commit comments