Commit 5b194d0c authored by shangbj's avatar shangbj

update

parent 76d684b6
const chalk = require('chalk')
const logSymbols = require('log-symbols');
console.log(chalk.blue.bgRed.bold('Hello world!'));
console.log(logSymbols.success, chalk.red('Hello world!'));
process.exit(1)
// process.exit(1)
const execSync = require('child_process').execSync
// const execSync = require('child_process').execSync
// git 对所有冲突的地方都会生成下面这种格式的信息,所以写个检测冲突文件的正则
const isConflictRegular = "^<<<<<<<\\s|^=======$|^>>>>>>>\\s"
// // git 对所有冲突的地方都会生成下面这种格式的信息,所以写个检测冲突文件的正则
// const isConflictRegular = "^<<<<<<<\\s|^=======$|^>>>>>>>\\s"
let results
// let results
try {
// git grep 命令会执行 perl 的正则匹配所有满足冲突条件的文件
results = execSync(`git grep -n -P "${isConflictRegular}"`, {encoding: 'utf-8'})
} catch (e) {
console.log('没有发现冲突,等待 commit')
process.exit(0)
}
// 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)
}
// if(results) {
// console.error('发现冲突,请解决后再提交,冲突文件:')
// console.error(results.trim())
// process.exit(1)
// }
process.exit(0)
\ No newline at end of file
......@@ -12,7 +12,7 @@
},
"husky": {
"hooks": {
"commit-msg": "node ./build/hooks.js"
"commit-msg": "node ./build/commit-hook.js"
}
},
"keywords": [],
......@@ -23,6 +23,7 @@
"git-branch-is": "^3.1.0",
"git-repo-info": "^2.1.1",
"husky": "^4.2.3",
"log-symbols": "^3.0.0",
"shelljs": "^0.8.3"
}
}
......@@ -68,7 +68,7 @@ callsites@^3.0.0:
resolved "https://registry.yarnpkg.com/callsites/-/callsites-3.1.0.tgz#b3630abd8943432f54b3f0519238e33cd7df2f73"
integrity sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==
chalk@^2.0.0:
chalk@^2.0.0, chalk@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.4.2.tgz#cd42541677a54333cf541a49108c1432b44c9424"
integrity sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==
......@@ -280,6 +280,13 @@ locate-path@^5.0.0:
dependencies:
p-locate "^4.1.0"
log-symbols@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/log-symbols/-/log-symbols-3.0.0.tgz#f3a08516a5dea893336a7dee14d18a1cfdab77c4"
integrity sha512-dSkNGuI7iG3mfvDzUuYZyvk5dD9ocYCYzNU6CYDE6+Xqd+gwme6Z00NS3dUh8mq/73HaEtT7m6W+yUPtU6BZnQ==
dependencies:
chalk "^2.4.2"
minimatch@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.0.4.tgz#5166e286457f03306064be5497e8dbb0c3d32083"
......
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