Skip to content

Commit

Permalink
Revert "update husky"
Browse files Browse the repository at this point in the history
This reverts commit 86d81ea.
  • Loading branch information
joeworkman committed Aug 18, 2023
1 parent 86d81ea commit 9ea2770
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 289 deletions.
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -73,7 +73,7 @@
"gulp-uglify": "^3.0.0",
"gulp-zip": "^5.1.0",
"gulp4-run-sequence": "^1.0.2",
"husky": "^8.0.3",
"husky": "^8.0.0",
"is-empty-object": "^1.1.1",
"jquery": ">=3.6.0",
"js-yaml": "^3.12.1",
Expand Down
24 changes: 24 additions & 0 deletions script/husky-commit-lint.js
@@ -0,0 +1,24 @@
const { yellow, red } = require('kleur');
const spawn = require('child_process').spawn

const args = process.argv.splice(process.execArgv.length + 2);

console.log(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(red(err))
})

child.on('exit', function (code) {
if(code !== 0){
console.log(yellow('🐶 ✗ Commit message is invalid.'))
console.log(yellow(' See https://git.io/contribute for help'))
process.exit(code);
}
})
23 changes: 23 additions & 0 deletions script/husky-commit-test.js
@@ -0,0 +1,23 @@
const { yellow, red } = require('kleur');
const spawn = require('child_process').spawn

console.log(yellow('🐶 Checking tests before committing...'))

const child = spawn('yarn test', [], { shell: true })

child.stdout.on('data', function (data) {
process.stdout.write(data)
})

child.on('error', function (err) {
console.log(red(err))
})

child.on('exit', function (code) {
if(code === 0){
console.log(yellow('🐶 ✓ Tests run well, we can commit...'))
} else {
console.log(yellow('🐶 ✗ Tests are failing, please fix them before committing.'))
process.exit(code);
}
})
23 changes: 23 additions & 0 deletions script/husky-push-test.js
@@ -0,0 +1,23 @@
const { yellow, red } = require('kleur');
const spawn = require('child_process').spawn

console.log(yellow('🐶 Checking tests before pushing...'))

const child = spawn('yarn test', [], { shell: true })

child.stdout.on('data', function (data) {
process.stdout.write(data)
})

child.on('error', function (err) {
console.log(red(err))
})

child.on('exit', function (code) {
if(code === 0){
console.log(yellow('🐶 ✓ Tests run well, we can push...'))
} else {
console.log(yellow('🐶 ✗ Tests are failing, please fix them before pushing.'))
process.exit(code);
}
})

0 comments on commit 9ea2770

Please sign in to comment.