mirror of https://github.com/typicode/husky.git
style: indent
This commit is contained in:
parent
2da78cb5eb
commit
c1bbd9b858
18
bin.js
18
bin.js
|
@ -5,18 +5,18 @@ import i from './index.js'
|
|||
let a = process.argv[2]
|
||||
|
||||
if (a == 'init') {
|
||||
let p = 'package.json'
|
||||
let d = JSON.parse(f.readFileSync(p))
|
||||
;(d.scripts ||= {}).prepare = 'husky'
|
||||
w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n')
|
||||
process.stdout.write(i())
|
||||
try { f.mkdirSync('.husky') } catch {}
|
||||
w('.husky/pre-commit', process.env.npm_config_user_agent.split('/')[0] + ' test\n')
|
||||
process.exit()
|
||||
let p = 'package.json'
|
||||
let d = JSON.parse(f.readFileSync(p))
|
||||
; (d.scripts ||= {}).prepare = 'husky'
|
||||
w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n')
|
||||
process.stdout.write(i())
|
||||
try { f.mkdirSync('.husky') } catch { }
|
||||
w('.husky/pre-commit', process.env.npm_config_user_agent.split('/')[0] + ' test\n')
|
||||
process.exit()
|
||||
}
|
||||
|
||||
let d = c => console.error(`${c} command is deprecated`)
|
||||
if (['add', 'set', 'uninstall'].includes(a)) { d(a); process.exit(1) }
|
||||
if (a == 'install') d(a)
|
||||
|
||||
process.stdout.write(i(a == 'install' ? undefined : a))
|
||||
process.stdout.write(i(a == 'install' ? undefined : a))
|
2
husky.sh
2
husky.sh
|
@ -18,4 +18,4 @@ c=$?
|
|||
|
||||
[ $c != 0 ] && echo "husky - $h script failed (code $c)"
|
||||
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
|
||||
exit $c
|
||||
exit $c
|
|
@ -1 +1 @@
|
|||
export default function (dir?: string): string;
|
||||
export default function (dir?: string): string;
|
2
index.js
2
index.js
|
@ -20,4 +20,4 @@ export default (d = '.husky') => {
|
|||
l.forEach(h => w(_(h), `#!/usr/bin/env sh\n. "\${0%/*}/h"`, { mode: 0o755 }))
|
||||
w(_('husky.sh'), '')
|
||||
return ''
|
||||
}
|
||||
}
|
|
@ -22,4 +22,4 @@
|
|||
"engines": {
|
||||
"node": ">=18"
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue