Comparing version 9.1.0 to 9.1.1
18
index.js
import c from 'child_process' | ||
import f, { writeFileSync as w } from 'fs' | ||
import f, { readdir, writeFileSync as w } from 'fs' | ||
import p from 'path' | ||
let l = [ 'pre-commit', 'prepare-commit-msg', 'commit-msg', 'post-commit', 'applypatch-msg', 'pre-applypatch', 'post-applypatch', 'pre-rebase', 'post-rewrite', 'post-checkout', 'post-merge', 'pre-push', 'pre-auto-gc' ] | ||
let l = [ 'pre-commit', 'prepare-commit-msg', 'commit-msg', 'post-commit', 'applypatch-msg', 'pre-applypatch', 'post-applypatch', 'pre-rebase', 'post-rewrite', 'post-checkout', 'post-merge', 'pre-push', 'pre-auto-gc' ], | ||
re = /^(#!\/usr\/bin\/env sh|\. "\$\(dirname -- "\$0"\)\/_\/husky\.sh")\r?\n/gm | ||
@@ -17,8 +18,17 @@ export default (d = '.husky') => { | ||
f.rmSync(_('husky.sh'), { force: true }) | ||
l.forEach(h => { | ||
let hp = p.join(d, h) | ||
if (!f.existsSync(hp)) return | ||
let prev = f.readFileSync(hp, 'utf8') | ||
let next = prev.replace(re, '') | ||
if (prev !== next) console.log(`husky - removed deprecated code from ${hp}`) | ||
f.writeFileSync(hp, next) | ||
}) | ||
f.mkdirSync(_(), { recursive: true }) | ||
w(_('.gitignore'), '*') | ||
f.copyFileSync(new URL('husky', import.meta.url), _('h')) | ||
l.forEach(h => w(_(h), `#!/usr/bin/env sh\n. "\${0%/*}/h"`, { mode: 0o755 })) | ||
w(_('husky.sh'), 'echo "husky - `#!/usr/bin/env sh` and `. "$(dirname -- "$0")/_/husky.sh"` lines in hooks are DEPRECATED and won\'t be supported in v10. You can remove these two lines for even simpler scripts"') | ||
l.forEach(h => w(_(h), `#!/usr/bin/env sh\n. "\$(dirname "\$0")/h"`, { mode: 0o755 })) | ||
return '' | ||
} |
{ | ||
"name": "husky", | ||
"version": "9.1.0", | ||
"version": "9.1.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "Modern native Git hooks", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4209
47