@@ -19,13 +19,34 @@ import {
1919 printHeader ,
2020} from '@socketsecurity/lib-stable/stdio/header'
2121
22- import { runParallel } from './utils/run-command.mts'
22+ import { runCommandQuiet , runParallel } from './utils/run-command.mts'
2323
2424const logger = getDefaultLogger ( )
2525
26+ async function runTypeCheck ( quiet = false ) : Promise < number > {
27+ if ( ! quiet ) {
28+ logger . progress ( 'Checking TypeScript' )
29+ }
30+ const result = await runCommandQuiet ( 'tsgo' , [ '--noEmit' ] )
31+ if ( result . exitCode !== 0 ) {
32+ if ( ! quiet ) {
33+ logger . error ( 'Type checks failed' )
34+ }
35+ if ( result . stdout ) {
36+ console . log ( result . stdout )
37+ }
38+ return result . exitCode
39+ }
40+ if ( ! quiet ) {
41+ logger . clearLine ( ) . done ( 'Type checks passed' )
42+ }
43+ return 0
44+ }
45+
2646async function main ( ) : Promise < void > {
2747 try {
2848 const all = process . argv . includes ( '--all' )
49+ const quiet = process . argv . includes ( '--quiet' )
2950 const staged = process . argv . includes ( '--staged' )
3051 const help = process . argv . includes ( '--help' ) || process . argv . includes ( '-h' )
3152
@@ -66,15 +87,7 @@ async function main(): Promise<void> {
6687 } ,
6788 } )
6889
69- // TypeScript type checking always runs on whole project
7090 checks . push (
71- {
72- args : [ 'exec' , 'tsgo' , '--noEmit' ] ,
73- command : 'pnpm' ,
74- options : {
75- ...( process . platform === 'win32' && { shell : true } ) ,
76- } ,
77- } ,
7891 {
7992 args : [ 'scripts/validate/no-link-deps.mts' ] ,
8093 command : 'node' ,
@@ -132,10 +145,17 @@ async function main(): Promise<void> {
132145 if ( failed ) {
133146 logger . error ( 'Some checks failed' )
134147 process . exitCode = 1
135- } else {
136- logger . success ( 'All checks passed' )
137- printFooter ( )
148+ return
138149 }
150+
151+ const typeCheckExitCode = await runTypeCheck ( quiet )
152+ if ( typeCheckExitCode !== 0 ) {
153+ process . exitCode = typeCheckExitCode
154+ return
155+ }
156+
157+ logger . success ( 'All checks passed' )
158+ printFooter ( )
139159 } catch ( error ) {
140160 logger . error ( `Check failed: ${ error . message } ` )
141161 process . exitCode = 1
0 commit comments