File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change 36
36
"test:types" : " tsc -p types/test" ,
37
37
"docs" : " vuepress dev docs" ,
38
38
"docs:build" : " vuepress build docs" ,
39
- "release" : " bash build/release.sh"
39
+ "release" : " bash build/release.sh" ,
40
+ "prepublishOnly" : " npm run build && conventional-changelog -p angular -r 2 -i CHANGELOG.md -s"
41
+ },
42
+ "gitHooks" : {
43
+ "pre-commit" : " lint-staged" ,
44
+ "commit-msg" : " node scripts/verifyCommitMsg.js"
45
+ },
46
+ "lint-staged" : {
47
+ "*.{js,vue}" : [
48
+ " eslint --fix" ,
49
+ " git add"
50
+ ]
40
51
},
41
52
"devDependencies" : {
42
53
"babel-core" : " ^6.24.1" ,
Original file line number Diff line number Diff line change
1
+ const chalk = require ( 'chalk' ) // eslint-disable-line
2
+ const msgPath = process . env . GIT_PARAMS
3
+ const msg = require ( 'fs' ) . readFileSync ( msgPath , 'utf-8' ) . trim ( )
4
+
5
+ const commitRE = / ^ ( v \d + \. \d + \. \d + ( - ( a l p h a | b e t a | r c .\d + ) ) ? $ ) | ( ( 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