Skip to content

Commit e42567f

Browse files
authored
docs(CONTRIBUTING): add commit message guidelines (NativeScript#5430)
1 parent 68d86fb commit e42567f

File tree

1 file changed

+128
-1
lines changed

1 file changed

+128
-1
lines changed

CONTRIBUTING.md

Lines changed: 128 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Here are some guides on how to do that:
77
- [Reporting Bugs](#bugs)
88
- [Requesting New Features](#features)
99
- [Submitting a PR](#pr)
10+
- [Commit Message Guidelines](#commit-messages)
1011

1112
## <a name="coc"></a> Code of Conduct
1213
Help us keep a healthy and open community. We expect all participants in this project to adhere to the [NativeScript Code Of Conduct](https://github.com/NativeScript/codeofconduct).
@@ -73,6 +74,132 @@ git push origin <my-fix-branch> --force
7374
It's our turn from there on! We will review the PR and discuss changes you might have to make before merging it! Thanks!
7475

7576

76-
### Where to Start
77+
## <a name="commit-messages"></a> Commit Message Guidelines
78+
79+
Please follow the git commit message format described below when committing your changes or submitting a PR. That allows us to use the commit messages to generate a change log for every new release.
80+
81+
### Commit Message Format
82+
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
83+
format that includes a **type**, a **scope** and a **subject**:
84+
85+
```
86+
<type>(<scope>): <subject>
87+
<BLANK LINE>
88+
<body>
89+
<BLANK LINE>
90+
<footer>
91+
```
92+
93+
The **header** is mandatory and the **scope** of the header is optional.
94+
95+
Any line of the commit message cannot be longer 100 characters! This allows the message to be easier
96+
to read on GitHub as well as in various git tools.
97+
98+
Footer should contain a [closing reference to an issue](https://help.github.com/articles/closing-issues-via-commit-messages/) if any.
99+
100+
Samples:
101+
102+
```
103+
docs(README): add link to NativeScript roadmap
104+
```
105+
```
106+
fix(ios-layouts): switch contentInsetAdjustmentBehavior on ScrollView
107+
108+
Do not auto adjust the ScrollView insets, by disabling contentInsetAdjustmentBehavior property, when ScrollView is used as a root Page element.
109+
```
110+
```
111+
release: cut the 3.2.0 release
112+
```
113+
114+
### Revert
115+
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.
116+
117+
### Type
118+
Must be one of the following:
119+
120+
* **build**: Changes that affect the build system or external dependencies (example scopes: npm, grunt)
121+
* **ci**: Changes to our CI configuration files and scripts (example scopes: Travis, Jenkins)
122+
* **docs**: Documentation only changes
123+
* **feat**: A new feature
124+
* **fix**: A bug fix
125+
* **fix-next**: A fix for a bug in the master branch, that's not yet released
126+
* **perf**: A code change that improves performance
127+
* **refactor**: A code change that neither fixes a bug nor adds a feature
128+
* **release**: Reference commit for the git tag of the release
129+
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
130+
* **test**: Adding missing tests or correcting existing tests (example scopes: e2e, name-of-the-test-app)
131+
132+
### Scope
133+
The scope should be the name of the affected component in the code.
134+
If the change affects only one of the target platforms (android, ios) that should be specified in the scope.
135+
136+
Sample scopes for the `tns-core-modules` package:
137+
138+
* **android/application**
139+
* **ios/application**
140+
* **action-bar**
141+
* **animations**
142+
* **date-picker**
143+
* **profiling**
144+
145+
### Subject
146+
The subject contains succinct description of the change:
147+
148+
* use the imperative, present tense: "change" not "changed" nor "changes"
149+
* don't capitalize first letter
150+
* no dot (.) at the end
151+
152+
### Body
153+
Just as in the **subject**, use the imperative, present tense: "change" not "changed" nor "changes".
154+
The body should include the motivation for the change and contrast this with previous behavior.
155+
156+
### Footer
157+
The footer should contain any information about **Breaking Changes** and is also the place to
158+
reference GitHub issues that this commit **Closes**.
159+
160+
**Breaking Changes** should start with the word `BREAKING CHANGE:` with a space or two newlines. Describe the changes and provide a migration guide for any code that may be affected.
161+
Sample:
162+
```
163+
feat: Angular 4.2 support
164+
165+
BREAKING CHANGES:
166+
167+
168+
NativeScriptModule should be imported only in the root application
169+
module (usually named AppModule).
170+
ApplicationModule.
171+
All other NgModules in the app (both feature and lazy-loaded ones)
172+
should import the NativeScriptCommonModule instead.
173+
The behaviour is alligned with BrowserModule and CommonModule in web
174+
Angular apps. angular.io/guide/ngmodule-faq#q-browser-vs-common-module
175+
Migration steps:
176+
In all NgModules, instead of the root one, replace:
177+
178+
import { NativeScriptModule } from "nativescript-angular/nativescript.module";
179+
180+
@NgModule({
181+
imports: [
182+
NativeScriptModule,
183+
]
184+
185+
})
186+
187+
with:
188+
189+
import { NativeScriptCommonModule } from "nativescript-angular/common";
190+
191+
@NgModule({
192+
imports: [
193+
NativeScriptCommonModule,
194+
]
195+
196+
})
197+
```
198+
The above guidelines are based on the [AngularJS Git Commit Message Conventions][commit-message-format]. A detailed explanation and additional examples can be found in this [document][commit-message-format].
199+
200+
## Where to Start
77201

78202
If you want to contribute, but you are not sure where to start - look for [issues labeled `help wanted`](https://github.com/NativeScript/NativeScript/issues?q=is%3Aopen+is%3Aissue+label%3A%22help+wanted%22).
203+
204+
205+
[commit-message-format]: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#

0 commit comments

Comments
 (0)