Skip to content

Commit d0cbfc0

Browse files
committed
feat: Add commit validation and commits template
In order to have a similar structure in the commit messages of the contributions, adding a commit validation hook, that a subset of the structure of angular.js validation messages.
1 parent 17fa093 commit d0cbfc0

4 files changed

Lines changed: 93 additions & 8 deletions

File tree

.fitcommitjsrc.json

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"validators": {
3+
"lineLength": {
4+
"enabled": true,
5+
"maxLineLength": 100,
6+
"subjectMaxLength": 100
7+
},
8+
"emptyLines": {
9+
"enabled": false
10+
},
11+
"tags": {
12+
"enabled": true,
13+
"tags": "feat, fix, docs, style, refactor, perf, test, chore, revert",
14+
"lineOfTheTag": 1
15+
},
16+
"subjectTense": {
17+
"enabled": true
18+
},
19+
"wip": {
20+
"enabled": true,
21+
"branch": "master"
22+
}
23+
}
24+
}

CONTRIBUTING.md

Lines changed: 28 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Most of the time, when webpack does not work correctly, it might be a configurat
1111

1212
If you are still having difficulty after looking over your configuration carefully, please post
1313
a question to [StackOverflow with the webpack-cli tag](http://stackoverflow.com/tags/webpack-cli). Questions
14-
that include your webpack.config.js and relevant files, this way you help others to help you.
14+
that include your `webpack.config.js` and relevant files, this way you help others to help you.
1515

1616
**If you have discovered a bug or have a feature suggestion, feel free to create an issue on Github.**
1717

@@ -21,7 +21,7 @@ that include your webpack.config.js and relevant files, this way you help others
2121
*Note: Node 6 or greater would be better for "best results".*
2222
* Fork the **webpack-cli** repo at [https://github.com/webpack/webpack-cli](https://github.com/webpack/webpack-cli).
2323
* `git clone <your-clone-url> && cd webpack-cli`
24-
* `git checkout develop`
24+
* Install the commit validator: `npm run install-commit-validator`
2525

2626
### Setup with npm
2727
* Install the dependencies: `npm install`
@@ -86,6 +86,31 @@ In case you've got a small change in most of the cases your pull request would b
8686
* Follow the existing coding style
8787
* Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html)
8888

89+
## Commit message format
90+
91+
Our commit messages format follows the [angular.js commits format](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format).
92+
93+
We don't use the scope. The template of a commit would look like this:
94+
95+
### Commit Message Format
96+
Each commit message consists of a **header**, a **body** and a **footer**. The header has a special
97+
format that includes a **type** and a **subject**:
98+
99+
```
100+
<type>: <subject>
101+
<BLANK LINE>
102+
<body>
103+
<BLANK LINE>
104+
<footer>
105+
```
106+
107+
The **header** is mandatory.
108+
109+
Any line of the commit message cannot be longer 100 characters. This allows the message to be easier
110+
to read on GitHub as well as in several git tools.
111+
112+
For more information about what each part of the template mean, head up to the documentation in the
113+
[angular repo](https://github.com/angular/angular.js/blob/master/CONTRIBUTING.md#commit-message-format)
89114

90115
## Contributor License Agreement
91116

@@ -96,6 +121,6 @@ Run `git config user.email` to see your Git email, and verify it with [your GitH
96121

97122
## Documentation
98123

99-
webpack is insanely feature rich and documentation is a time sink. We
124+
webpack is feature rich and documentation is a time sink. We
100125
greatly appreciate any time spent fixing typos or clarifying sections in the
101126
documentation.

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,12 @@
1313
},
1414
"main": "./bin/cli.js",
1515
"scripts": {
16-
"lint": "eslint ./lib"
16+
"lint": "eslint ./lib",
17+
"install-commit-validator": "fit-commit-js install"
1718
},
1819
"dependencies": {
1920
"enhanced-resolve": "^3.0.2",
21+
"fit-commit-js": "^0.3.1",
2022
"interpret": "^1.0.1",
2123
"supports-color": "^3.1.2",
2224
"webpack": "^2.2.0-rc.0",

yarn.lock

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ date-now@^0.1.4:
507507
version "0.1.4"
508508
resolved "https://registry.yarnpkg.com/date-now/-/date-now-0.1.4.tgz#eaf439fd4d4848ad74e5cc7dbef200672b9e345b"
509509

510-
debug@^2.1.1:
510+
debug@^2.1.1, debug@^2.2.0:
511511
version "2.4.4"
512512
resolved "https://registry.yarnpkg.com/debug/-/debug-2.4.4.tgz#c04d17a654e9202464803f096153f70a6f31f4be"
513513
dependencies:
@@ -837,6 +837,17 @@ find-up@^1.0.0:
837837
path-exists "^2.0.0"
838838
pinkie-promise "^2.0.0"
839839

840+
fit-commit-js@^0.3.1:
841+
version "0.3.1"
842+
resolved "https://registry.yarnpkg.com/fit-commit-js/-/fit-commit-js-0.3.1.tgz#55c08fa17100b5b8fd347c373459f4a1754e4caf"
843+
dependencies:
844+
debug "^2.2.0"
845+
git-rev-sync "^1.4.0"
846+
is-my-json-valid "^2.13.1"
847+
js-yaml "^3.4.6"
848+
npmlog "^4.0.0"
849+
ramda "^0.22.1"
850+
840851
flat-cache@^1.2.1:
841852
version "1.2.1"
842853
resolved "https://registry.yarnpkg.com/flat-cache/-/flat-cache-1.2.1.tgz#6c837d6225a7de5659323740b36d5361f71691ff"
@@ -930,6 +941,13 @@ getpass@^0.1.1:
930941
dependencies:
931942
assert-plus "^1.0.0"
932943

944+
git-rev-sync@^1.4.0:
945+
version "1.8.0"
946+
resolved "https://registry.yarnpkg.com/git-rev-sync/-/git-rev-sync-1.8.0.tgz#15c5708b905877af1d75dd9f147106f715415066"
947+
dependencies:
948+
graceful-fs "4.1.6"
949+
shelljs "0.7.4"
950+
933951
glob-base@^0.3.0:
934952
version "0.3.0"
935953
resolved "https://registry.yarnpkg.com/glob-base/-/glob-base-0.3.0.tgz#dbb164f6221b1c0b1ccf82aea328b497df0ea3c4"
@@ -969,6 +987,10 @@ globby@^5.0.0:
969987
pify "^2.0.0"
970988
pinkie-promise "^2.0.0"
971989

990+
graceful-fs@4.1.6:
991+
version "4.1.6"
992+
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.6.tgz#514c38772b31bee2e08bedc21a0aeb3abf54c19e"
993+
972994
graceful-fs@^4.1.2:
973995
version "4.1.11"
974996
resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.1.11.tgz#0e8bdfe4d1ddb8854d64e04ea7c00e2a026e5658"
@@ -1150,7 +1172,7 @@ is-glob@^2.0.0, is-glob@^2.0.1:
11501172
dependencies:
11511173
is-extglob "^1.0.0"
11521174

1153-
is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4:
1175+
is-my-json-valid@^2.10.0, is-my-json-valid@^2.12.4, is-my-json-valid@^2.13.1:
11541176
version "2.15.0"
11551177
resolved "https://registry.yarnpkg.com/is-my-json-valid/-/is-my-json-valid-2.15.0.tgz#936edda3ca3c211fd98f3b2d3e08da43f7b2915b"
11561178
dependencies:
@@ -1231,7 +1253,7 @@ js-tokens@^2.0.0:
12311253
version "2.0.0"
12321254
resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-2.0.0.tgz#79903f5563ee778cc1162e6dcf1a0027c97f9cb5"
12331255

1234-
js-yaml@^3.5.1:
1256+
js-yaml@^3.4.6, js-yaml@^3.5.1:
12351257
version "3.7.0"
12361258
resolved "https://registry.yarnpkg.com/js-yaml/-/js-yaml-3.7.0.tgz#5c967ddd837a9bfdca5f2de84253abe8a1c03b80"
12371259
dependencies:
@@ -1488,7 +1510,7 @@ normalize-path@^2.0.1:
14881510
version "2.0.1"
14891511
resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-2.0.1.tgz#47886ac1662760d4261b7d979d241709d3ce3f7a"
14901512

1491-
npmlog@^4.0.1:
1513+
npmlog@^4.0.0, npmlog@^4.0.1:
14921514
version "4.0.2"
14931515
resolved "https://registry.yarnpkg.com/npmlog/-/npmlog-4.0.2.tgz#d03950e0e78ce1527ba26d2a7592e9348ac3e75f"
14941516
dependencies:
@@ -1690,6 +1712,10 @@ querystring@0.2.0:
16901712
version "0.2.0"
16911713
resolved "https://registry.yarnpkg.com/querystring/-/querystring-0.2.0.tgz#b209849203bb25df820da756e747005878521620"
16921714

1715+
ramda@^0.22.1:
1716+
version "0.22.1"
1717+
resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.22.1.tgz#031da0c3df417c5b33c96234757eb37033f36a0e"
1718+
16931719
randomatic@^1.1.3:
16941720
version "1.1.6"
16951721
resolved "https://registry.yarnpkg.com/randomatic/-/randomatic-1.1.6.tgz#110dcabff397e9dcff7c0789ccc0a49adf1ec5bb"
@@ -1901,6 +1927,14 @@ sha.js@^2.3.6:
19011927
dependencies:
19021928
inherits "^2.0.1"
19031929

1930+
shelljs@0.7.4:
1931+
version "0.7.4"
1932+
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.4.tgz#b8f04b3a74ddfafea22acf98e0be45ded53d59c8"
1933+
dependencies:
1934+
glob "^7.0.0"
1935+
interpret "^1.0.0"
1936+
rechoir "^0.6.2"
1937+
19041938
shelljs@^0.7.5:
19051939
version "0.7.5"
19061940
resolved "https://registry.yarnpkg.com/shelljs/-/shelljs-0.7.5.tgz#2eef7a50a21e1ccf37da00df767ec69e30ad0675"

0 commit comments

Comments
 (0)