feat: transpilling all javascript components and utils to typescript as well as affiliated husky features

This commit is contained in:
andatoshiki 2023-03-24 16:58:00 +08:00
parent 83a55c7f0d
commit d147cfe573
2 changed files with 18 additions and 1 deletions

View File

@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
node scripts/verifyCommit.js
node scripts/verifyCommit.ts

17
scripts/verifyCommit.ts Normal file
View File

@ -0,0 +1,17 @@
import { readFileSync } from 'fs'
const msg: string = readFileSync('.git/COMMIT_EDITMSG', 'utf-8').trim()
const commitRE: RegExp = /^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(\(.+\))?: .{1,50}/
const mergeRe: RegExp = /^(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')
}