Socket
Socket
Sign inDemoInstall

husky

Package Overview
Dependencies
Maintainers
1
Versions
213
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

husky - npm Package Compare versions

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",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc