@@ -17,48 +17,50 @@ function execFile(command, args) {
17
17
} )
18
18
}
19
19
20
- ; ( async function ( ) {
21
- let runs = 0
22
- const codes = [ ]
23
- const commands = [ ]
20
+ try {
21
+ ; ( async function ( ) {
22
+ let runs = 0
23
+ const codes = [ ]
24
+ const commands = [ ]
24
25
25
- let eslintOptions = [ '--report-unused-disable-directives' , '.' ]
26
+ let eslintOptions = [ '--report-unused-disable-directives' , '.' ]
26
27
27
- if ( hasBasicColorSupport ) {
28
- eslintOptions = eslintOptions . concat ( [ '--color' ] )
29
- }
28
+ if ( hasBasicColorSupport ) {
29
+ eslintOptions = eslintOptions . concat ( [ '--color' ] )
30
+ }
30
31
31
- const isTypeScriptProject = fs . existsSync ( 'tsconfig.json' )
32
+ const isTypeScriptProject = fs . existsSync ( 'tsconfig.json' )
32
33
33
- if ( isTypeScriptProject ) {
34
- eslintOptions = eslintOptions . concat ( [ '--ext' , '.js,.ts,.tsx' ] )
35
- }
34
+ if ( isTypeScriptProject ) {
35
+ eslintOptions = eslintOptions . concat ( [ '--ext' , '.js,.ts,.tsx' ] )
36
+ }
36
37
37
- commands . push ( [ 'eslint' , eslintOptions ] )
38
+ commands . push ( [ 'eslint' , eslintOptions ] )
38
39
39
- if ( isTypeScriptProject ) {
40
- commands . push ( [ 'tsc' , [ '--noEmit' ] ] )
41
- }
40
+ if ( isTypeScriptProject ) {
41
+ commands . push ( [ 'tsc' , [ '--noEmit' ] ] )
42
+ }
42
43
43
- for ( const [ command , args ] of commands ) {
44
- if ( runs > 0 ) process . stderr . write ( '\n' )
45
- process . stderr . write ( `> ${ command } ${ args . join ( ' ' ) } \n` )
44
+ for ( const [ command , args ] of commands ) {
45
+ if ( runs > 0 ) process . stderr . write ( '\n' )
46
+ process . stderr . write ( `> ${ command } ${ args . join ( ' ' ) } \n` )
46
47
47
- const { code, stdout, stderr} = await execFile ( command , args )
48
- codes . push ( code )
49
- if ( stderr ) process . stderr . write ( stderr )
50
- if ( stdout ) process . stdout . write ( stdout )
48
+ const { code, stdout, stderr} = await execFile ( command , args )
49
+ codes . push ( code )
50
+ if ( stderr ) process . stderr . write ( stderr )
51
+ if ( stdout ) process . stdout . write ( stdout )
51
52
52
- runs ++
53
- }
53
+ runs ++
54
+ }
54
55
55
- const nonzero = codes . find ( code => code !== 0 )
56
- if ( nonzero ) {
57
- process . stderr . write ( `\nCommand failed: ${ nonzero } \n` )
58
- process . exit ( nonzero )
59
- }
60
- } ) ( ) . catch ( error => {
56
+ const nonzero = codes . find ( code => code !== 0 )
57
+ if ( nonzero ) {
58
+ process . stderr . write ( `\nCommand failed: ${ nonzero } \n` )
59
+ process . exit ( nonzero )
60
+ }
61
+ } )
62
+ } catch ( error ) {
61
63
setTimeout ( ( ) => {
62
64
throw error
63
65
} )
64
- } )
66
+ }
0 commit comments