File tree 2 files changed +20
-1
lines changed
2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 17
17
"boot" : " node scripts/bootstrap.js"
18
18
},
19
19
"gitHooks" : {
20
- "pre-commit" : " lint-staged"
20
+ "pre-commit" : " lint-staged" ,
21
+ "commit-msg" : " node scripts/verifyCommitMsg.js"
21
22
},
22
23
"jest" : {
23
24
"testEnvironment" : " node" ,
Original file line number Diff line number Diff line change
1
+ const chalk = require ( 'chalk' )
2
+ const msgPath = process . env . GIT_PARAMS
3
+ const msg = require ( 'fs' ) . readFileSync ( msgPath , 'utf-8' ) . trim ( )
4
+
5
+ const commitRE = / ^ ( r e v e r t : ) ? ( f e a t | f i x | d o c s | s t y l e | r e f a c t o r | p e r f | t e s t | w o r k f l o w | c i | c h o r e | t y p e s ) ( \( .+ \) ) ? : .{ 1 , 50 } /
6
+
7
+ if ( ! commitRE . test ( msg ) ) {
8
+ console . log ( )
9
+ console . error (
10
+ ` ${ chalk . bgRed . white ( ' ERROR ' ) } ${ chalk . red ( `invalid commit message format.` ) } \n\n` +
11
+ chalk . red ( ` Proper commit message format is required for automated changelog generation. Examples:\n\n` ) +
12
+ ` ${ chalk . green ( `feat(compiler): add 'comments' option` ) } \n` +
13
+ ` ${ chalk . green ( `fix(v-model): handle events on blur (close #28)` ) } \n\n` +
14
+ chalk . red ( ` See .github/COMMIT_CONVENTION.md for more details.\n` ) +
15
+ chalk . red ( ` You can also use ${ chalk . cyan ( `npm run commit` ) } to interactively generate a commit message.\n` )
16
+ )
17
+ process . exit ( 1 )
18
+ }
You can’t perform that action at this time.
0 commit comments