@@ -17,48 +17,50 @@ function execFile(command, args) {
1717 } )
1818}
1919
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 = [ ]
2425
25- let eslintOptions = [ '--report-unused-disable-directives' , '.' ]
26+ let eslintOptions = [ '--report-unused-disable-directives' , '.' ]
2627
27- if ( hasBasicColorSupport ) {
28- eslintOptions = eslintOptions . concat ( [ '--color' ] )
29- }
28+ if ( hasBasicColorSupport ) {
29+ eslintOptions = eslintOptions . concat ( [ '--color' ] )
30+ }
3031
31- const isTypeScriptProject = fs . existsSync ( 'tsconfig.json' )
32+ const isTypeScriptProject = fs . existsSync ( 'tsconfig.json' )
3233
33- if ( isTypeScriptProject ) {
34- eslintOptions = eslintOptions . concat ( [ '--ext' , '.js,.ts,.tsx' ] )
35- }
34+ if ( isTypeScriptProject ) {
35+ eslintOptions = eslintOptions . concat ( [ '--ext' , '.js,.ts,.tsx' ] )
36+ }
3637
37- commands . push ( [ 'eslint' , eslintOptions ] )
38+ commands . push ( [ 'eslint' , eslintOptions ] )
3839
39- if ( isTypeScriptProject ) {
40- commands . push ( [ 'tsc' , [ '--noEmit' ] ] )
41- }
40+ if ( isTypeScriptProject ) {
41+ commands . push ( [ 'tsc' , [ '--noEmit' ] ] )
42+ }
4243
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` )
4647
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 )
5152
52- runs ++
53- }
53+ runs ++
54+ }
5455
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 ) {
6163 setTimeout ( ( ) => {
6264 throw error
6365 } )
64- } )
66+ }
0 commit comments