Skip to content

Commit d091328

Browse files
authored
fix: tab detection on install command (#1376)
1 parent 798f1ad commit d091328

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bin.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ let a = process.argv[2]
66

77
if (a == 'init') {
88
let p = 'package.json'
9-
let d = JSON.parse(f.readFileSync(p))
9+
let s = f.readFileSync(p);
10+
let d = JSON.parse(s)
1011
; (d.scripts ||= {}).prepare = 'husky'
11-
w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n')
12+
w('package.json', JSON.stringify(d, null, /\t/.test(s) ? '\t' : 2) + '\n')
1213
process.stdout.write(i())
1314
try { f.mkdirSync('.husky') } catch { }
1415
w('.husky/pre-commit', process.env.npm_config_user_agent.split('/')[0] + ' test\n')
@@ -19,4 +20,4 @@ let d = c => console.error(`${c} command is deprecated`)
1920
if (['add', 'set', 'uninstall'].includes(a)) { d(a); process.exit(1) }
2021
if (a == 'install') d(a)
2122

22-
process.stdout.write(i(a == 'install' ? undefined : a))
23+
process.stdout.write(i(a == 'install' ? undefined : a))

0 commit comments

Comments
 (0)