Commit 76d684b6 authored by shangbj's avatar shangbj

update

parent e6724e88
const chalk = require('chalk')
console.log(chalk.blue.bgRed.bold('Hello world!'));
process.exit(1)
const execSync = require('child_process').execSync
// git 对所有冲突的地方都会生成下面这种格式的信息,所以写个检测冲突文件的正则
const isConflictRegular = "^<<<<<<<\\s|^=======$|^>>>>>>>\\s"
let results
try {
// git grep 命令会执行 perl 的正则匹配所有满足冲突条件的文件
results = execSync(`git grep -n -P "${isConflictRegular}"`, {encoding: 'utf-8'})
} catch (e) {
console.log('没有发现冲突,等待 commit')
process.exit(0)
}
if(results) {
console.error('发现冲突,请解决后再提交,冲突文件:')
console.error(results.trim())
process.exit(1)
}
process.exit(0)
\ No newline at end of file
{
"pre-commit": "node ./build/commit.js",
"commit-msg": "node ./build/hooks.js $HUSKY_GIT_PARAMS $HUSKY_GIT_STDIN $GIT_INTERNAL_GETTEXT_SH_SCHEME $GIT_AUTHOR_EMAIL",
"pre-push": "node ./build/push.js $GIT_PUSH_OPTION_COUNT $GIT_PUSH_OPTION_0"
}
\ No newline at end of file
......@@ -12,15 +12,14 @@
},
"husky": {
"hooks": {
"pre-commit": "node ./build/commit.js",
"commit-msg": "node ./build/hooks.js $HUSKY_GIT_PARAMS $HUSKY_GIT_STDIN $GIT_INTERNAL_GETTEXT_SH_SCHEME $GIT_AUTHOR_EMAIL",
"pre-push": "node ./build/push.js $GIT_PUSH_OPTION_COUNT $GIT_PUSH_OPTION_0"
"commit-msg": "node ./build/hooks.js"
}
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"chalk": "^3.0.0",
"git-branch-is": "^3.1.0",
"git-repo-info": "^2.1.1",
"husky": "^4.2.3",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment