Skip to content

Commit 56619ec

Browse files
authored
fix: init error (#1353)
* fix: init error * Update config.mts
1 parent 26697d1 commit 56619ec

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

bin.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ let a = process.argv[2]
77
if (a == 'init') {
88
let p = 'package.json'
99
let d = JSON.parse(f.readFileSync(p))
10-
(d.scripts ||= {}).prepare = 'husky'
10+
;(d.scripts ||= {}).prepare = 'husky'
1111
w('package.json', JSON.stringify(d, null, /\t/.test() ? '\t' : 2) + '\n')
1212
process.stdout.write(i())
1313
try { f.mkdirSync('.husky') } catch {}

test.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,5 @@ sh test/3_from-sub-dir.sh
88
sh test/4_not-git-dir.sh
99
sh test/5_git_command_not_found.sh
1010
sh test/6_command_not_found.sh
11-
# sh test/7_time.sh
11+
sh test/7_init.sh
12+
# sh test/8_time.sh

test/7_init.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/sh
2+
. test/functions.sh
3+
setup
4+
install
5+
6+
npx --no-install husky init

test/7_time.sh test/8_time.sh

File renamed without changes.

0 commit comments

Comments
 (0)