biofriction-wp-theme/node_modules/foundation-sites/script/husky-commit-lint.js

25 lines
641 B
JavaScript
Raw Permalink Normal View History

2021-10-26 14:18:09 +02:00
const chalk = require('chalk')
const spawn = require('child_process').spawn
const args = process.argv.splice(process.execArgv.length + 2);
console.log(chalk.yellow('🐶 Checking the commit message...'))
const child = spawn('commitlint', args, { shell: true })
child.stdout.on('data', function (data) {
process.stdout.write(data)
})
child.on('error', function (err) {
console.log(chalk.red(err))
})
child.on('exit', function (code) {
if(code !== 0){
console.log(chalk.yellow('🐶 ✗ Commit message is invalid.'))
console.log(chalk.yellow(' See https://git.io/contribute for help'))
process.exit(code);
}
})