mirror of
https://github.com/LukeHagar/electron-vite.git
synced 2025-12-09 20:27:44 +00:00
chore: init
This commit is contained in:
22
scripts/verifyCommit.js
Normal file
22
scripts/verifyCommit.js
Normal file
@@ -0,0 +1,22 @@
|
||||
// Invoked on the commit-msg git hook by simple-git-hooks.
|
||||
|
||||
const colors = require('picocolors')
|
||||
const fs = require('fs')
|
||||
|
||||
const msgPath = process.argv[2]
|
||||
const msg = fs.readFileSync(msgPath, 'utf-8').trim()
|
||||
|
||||
const commitRE =
|
||||
/^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)(\(.+\))?: .{1,50}/
|
||||
|
||||
if (!commitRE.test(msg)) {
|
||||
console.log()
|
||||
console.error(
|
||||
` ${colors.bgRed.white(' ERROR ')} ${colors.red(`invalid commit message format.`)}\n\n` +
|
||||
colors.red(` Proper commit message format is required for automated changelog generation. Examples:\n\n`) +
|
||||
` ${colors.green(`feat: add 'comments' option`)}\n` +
|
||||
` ${colors.green(`fix: handle events on blur (close #28)`)}\n\n` +
|
||||
colors.red(` See .github/commit-convention.md for more details.\n`)
|
||||
)
|
||||
process.exit(1)
|
||||
}
|
||||
Reference in New Issue
Block a user