Skip to content

Commit 5c4db34

Browse files
bcabanesFrozenPandaz
authored andcommittedSep 14, 2018
fix(scripts): checkcommit allows release commit (#740)
1 parent c9e29a2 commit 5c4db34

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed
 

‎package.json

+8-11
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,17 @@
99
"commit": "git-cz",
1010
"checkcommit": "./scripts/commit-lint.js",
1111
"e2e": "./scripts/e2e.sh",
12-
"format": "prettier \"./**/*.{ts,js,json,css,md}\" \"!./**/{__name__,__directory__}/**\" --write",
12+
"format":
13+
"prettier \"./**/*.{ts,js,json,css,md}\" \"!./**/{__name__,__directory__}/**\" --write",
1314
"linknpm": "./scripts/link.sh",
1415
"nx-release": "./scripts/nx-release.js",
1516
"copy": "./scripts/copy.sh",
1617
"test:schematics": "yarn linknpm fast && ./scripts/test_schematics.sh",
1718
"test:nx": "yarn linknpm fast && ./scripts/test_nx.sh",
18-
"test": "yarn linknpm fast && ./scripts/test_nx.sh && ./scripts/test_schematics.sh",
19-
"checkformat": "prettier \"./**/*.{ts,js,json,css,md}\" \"!./**/{__name__,__directory__}/**\" --list-different"
19+
"test":
20+
"yarn linknpm fast && ./scripts/test_nx.sh && ./scripts/test_schematics.sh",
21+
"checkformat":
22+
"prettier \"./**/*.{ts,js,json,css,md}\" \"!./**/{__name__,__directory__}/**\" --list-different"
2023
},
2124
"devDependencies": {
2225
"@angular-devkit/build-angular": "^0.7.2",
@@ -81,21 +84,15 @@
8184
"author": "Victor Savkin",
8285
"license": "MIT",
8386
"jest": {
84-
"modulePathIgnorePatterns": [
85-
"tmp",
86-
"collection/.*/files"
87-
]
87+
"modulePathIgnorePatterns": ["tmp", "collection/.*/files"]
8888
},
8989
"husky": {
9090
"hooks": {
9191
"pre-commit": "lint-staged"
9292
}
9393
},
9494
"lint-staged": {
95-
"./**/*.{ts,js,json,css,md}": [
96-
"prettier --write",
97-
"git add"
98-
]
95+
"./**/*.{ts,js,json,css,md}": ["prettier --write", "git add"]
9996
},
10097
"config": {
10198
"commitizen": {

‎scripts/commit-lint.js

+7-4
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,25 @@ const gitMessage = require('child_process')
55
.execSync('git log -1 --no-merges')
66
.toString()
77
.trim();
8-
const matchTest = /([a-z]){0,8}\([a-z.0-9\-]+\):\s(([a-z0-9:\-\s])+)/g.test(
8+
const matchCommit = /([a-z]){0,8}\([a-z.0-9\-]+\):\s(([a-z0-9:\-\s])+)/g.test(
99
gitMessage
1010
);
11-
const exitCode = +!matchTest;
11+
const matchRelease = /release/gi.test(gitMessage);
12+
const exitCode = +!(matchRelease || matchCommit);
1213

1314
if (exitCode === 0) {
1415
console.log('Commit ACCEPTED 👌');
1516
} else {
1617
console.log(
1718
'[Error]: Ho no! 😦 Your commit message: \n' +
19+
'-------------------------------------------------------------------\n' +
1820
gitMessage +
19-
'\ndoes not follow the commit message convention specified in the CONTRIBUTING.MD file.'
21+
'\n-------------------------------------------------------------------' +
22+
'\n\n 👉️ Does not follow the commit message convention specified in the CONTRIBUTING.MD file.'
2023
);
2124
console.log('\ntype(scope): subject \n BLANK LINE \n body');
2225
console.log(
23-
'\nExample: \n ' +
26+
'\nEXAMPLE: \n ' +
2427
'feat(schematics): add an option to generate lazy-loadable modules\n' +
2528
'\n`ng generate lib mylib --lazy` provisions the mylib project in tslint.json'
2629
);

0 commit comments

Comments
 (0)
Please sign in to comment.