mirror of
https://github.com/andatoshiki/toshiki-notebook.git
synced 2026-06-05 21:46:28 +00:00
fix(husky): revert usage of node instead of ts-node for running commit message validation feature & switch typescript verfication util to cjs due to change in project property type to module of overall monorepo
This commit is contained in:
parent
3a0d40ac42
commit
740add740e
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
ts-node scripts/verifyCommit.ts
|
||||
node scripts/verifyCommit.cjs
|
||||
17
scripts/verifyCommit.cjs
Normal file
17
scripts/verifyCommit.cjs
Normal file
@ -0,0 +1,17 @@
|
||||
const msg = require('fs')
|
||||
.readFileSync('.git/COMMIT_EDITMSG', 'utf-8')
|
||||
.trim()
|
||||
|
||||
const commitRE = /^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(\(.+\))?: .{1,50}/
|
||||
const mergeRe = /^(Merge pull request|Merge branch)/
|
||||
if (!commitRE.test(msg)) {
|
||||
if(!mergeRe.test(msg)){
|
||||
console.log('git commit message does not pass validation')
|
||||
|
||||
console.error(`git commit message format error, use \" title(scope): desc\" as the format`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
}else{
|
||||
console.log('git commit message validation test passes')
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user