-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverifyCommit.js
More file actions
25 lines (22 loc) · 932 Bytes
/
Copy pathverifyCommit.js
File metadata and controls
25 lines (22 loc) · 932 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
const msgPath = process.env.HUSKY_GIT_PARAMS;
const msg = require('fs')
.readFileSync(msgPath, 'utf-8')
.trim();
console.log('test', process.env.HUSKY_GIT_PARAMS);
const commitRE = /^(revert: |Merge.+)|(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|chore|types|wip|merge)(\(.+\))?: .+/;
if (!commitRE.test(msg)) {
console.error(`ERROR: invalid commit message format`);
process.exit(1);
}
/* eslint no-console: 0 */
// const chalk = require('chalk');
// const msgPath = process.env.HUSKY_GIT_PARAMS;
// const msg = require('fs')
// .readFileSync(msgPath, 'utf-8')
// .trim();
// const commitRE = /^(revert: |Merge.+)|(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|chore|types|wip|merge)(\(.+\))?: .+/;
// if (!commitRE.test(msg)) {
// console.error(` ${chalk.bgRed.white(' ERROR ')} ${chalk.red('invalid commit message format.')}\n\n`);
// process.exit(1);
// }