File tree 1 file changed +16
-13
lines changed
1 file changed +16
-13
lines changed Original file line number Diff line number Diff line change 2
2
import f , { writeFileSync as w } from 'fs'
3
3
import i from './index.js'
4
4
5
- let a = process . argv [ 2 ]
5
+ let p , a , n , s , o , d
6
+
7
+ p = process
8
+ a = p . argv [ 2 ]
6
9
7
10
if ( a == 'init' ) {
8
- let p = 'package.json'
9
- let s = f . readFileSync ( p ) ;
10
- let d = JSON . parse ( s )
11
- ; ( d . scripts ||= { } ) . prepare = 'husky'
12
- w ( 'package.json' , JSON . stringify ( d , null , / \t / . test ( s ) ? '\t' : 2 ) + '\n' )
13
- process . stdout . write ( i ( ) )
14
- try { f . mkdirSync ( '.husky' ) } catch { }
15
- w ( '.husky/pre-commit' , process . env . npm_config_user_agent . split ( '/' ) [ 0 ] + ' test\n' )
16
- process . exit ( )
11
+ n = 'package.json'
12
+ s = f . readFileSync ( n )
13
+ o = JSON . parse ( s )
14
+ ; ( o . scripts ||= { } ) . prepare = 'husky'
15
+ w ( n , JSON . stringify ( o , 0 , / \t / . test ( s ) ? '\t' : 2 ) + '\n' )
16
+ p . stdout . write ( i ( ) )
17
+ try { f . mkdirSync ( '.husky' ) } catch { }
18
+ w ( '.husky/pre-commit' , p . env . npm_config_user_agent . split ( '/' ) [ 0 ] + ' test\n' )
19
+ p . exit ( )
17
20
}
18
21
19
- let d = c => console . error ( `${ c } command is deprecated` )
20
- if ( [ 'add' , 'set' , 'uninstall' ] . includes ( a ) ) { d ( a ) ; process . exit ( 1 ) }
22
+ d = c => console . error ( `${ c } command is deprecated` )
23
+ if ( [ 'add' , 'set' , 'uninstall' ] . includes ( a ) ) { d ( a ) ; p . exit ( 1 ) }
21
24
if ( a == 'install' ) d ( a )
22
25
23
- process . stdout . write ( i ( a == 'install' ? undefined : a ) )
26
+ p . stdout . write ( i ( a == 'install' ? undefined : a ) )
You can’t perform that action at this time.
0 commit comments