style: indent

This commit is contained in:
typicode 2024-01-26 00:41:29 +01:00
parent 2da78cb5eb
commit c1bbd9b858
5 changed files with 13 additions and 13 deletions

18
bin.js
View File

@ -5,18 +5,18 @@ import i from './index.js'
let a = process.argv[2] let a = process.argv[2]
if (a == 'init') { if (a == 'init') {
let p = 'package.json' let p = 'package.json'
let d = JSON.parse(f.readFileSync(p)) let d = JSON.parse(f.readFileSync(p))
;(d.scripts ||= {}).prepare = 'husky' ; (d.scripts ||= {}).prepare = 'husky'
w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n') w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n')
process.stdout.write(i()) process.stdout.write(i())
try { f.mkdirSync('.husky') } catch {} try { f.mkdirSync('.husky') } catch { }
w('.husky/pre-commit', process.env.npm_config_user_agent.split('/')[0] + ' test\n') w('.husky/pre-commit', process.env.npm_config_user_agent.split('/')[0] + ' test\n')
process.exit() process.exit()
} }
let d = c => console.error(`${c} command is deprecated`) let d = c => console.error(`${c} command is deprecated`)
if (['add', 'set', 'uninstall'].includes(a)) { d(a); process.exit(1) } if (['add', 'set', 'uninstall'].includes(a)) { d(a); process.exit(1) }
if (a == 'install') d(a) if (a == 'install') d(a)
process.stdout.write(i(a == 'install' ? undefined : a)) process.stdout.write(i(a == 'install' ? undefined : a))

View File

@ -18,4 +18,4 @@ c=$?
[ $c != 0 ] && echo "husky - $h script failed (code $c)" [ $c != 0 ] && echo "husky - $h script failed (code $c)"
[ $c = 127 ] && echo "husky - command not found in PATH=$PATH" [ $c = 127 ] && echo "husky - command not found in PATH=$PATH"
exit $c exit $c

2
index.d.ts vendored
View File

@ -1 +1 @@
export default function (dir?: string): string; export default function (dir?: string): string;

View File

@ -20,4 +20,4 @@ export default (d = '.husky') => {
l.forEach(h => w(_(h), `#!/usr/bin/env sh\n. "\${0%/*}/h"`, { mode: 0o755 })) l.forEach(h => w(_(h), `#!/usr/bin/env sh\n. "\${0%/*}/h"`, { mode: 0o755 }))
w(_('husky.sh'), '') w(_('husky.sh'), '')
return '' return ''
} }

View File

@ -22,4 +22,4 @@
"engines": { "engines": {
"node": ">=18" "node": ">=18"
} }
} }