@@ -19,7 +19,7 @@ import { fileURLToPath } from 'node:url'
1919import { getDefaultLogger } from '@socketsecurity/lib/logger'
2020import { printFooter , printHeader } from '@socketsecurity/lib/stdio/header'
2121
22- import { runCommand , runParallel } from './utils/run-command.mts'
22+ import { runCommand , runCommandQuiet , runParallel } from './utils/run-command.mts'
2323import process from 'node:process'
2424
2525const logger = getDefaultLogger ( )
@@ -28,9 +28,30 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url))
2828const rootPath = path . resolve ( __dirname , '..' )
2929const registryDistPath = path . join ( rootPath , 'registry' , 'dist' , 'index.js' )
3030
31+ async function runTypeCheck ( quiet = false ) : Promise < number > {
32+ if ( ! quiet ) {
33+ logger . progress ( 'Checking TypeScript' )
34+ }
35+ const result = await runCommandQuiet ( 'tsgo' , [ '--noEmit' ] )
36+ if ( result . exitCode !== 0 ) {
37+ if ( ! quiet ) {
38+ logger . error ( 'Type checks failed' )
39+ }
40+ if ( result . stdout ) {
41+ console . log ( result . stdout )
42+ }
43+ return result . exitCode
44+ }
45+ if ( ! quiet ) {
46+ logger . clearLine ( ) . done ( 'Type checks passed' )
47+ }
48+ return 0
49+ }
50+
3151async function main ( ) : Promise < void > {
3252 try {
3353 const all = process . argv . includes ( '--all' )
54+ const quiet = process . argv . includes ( '--quiet' )
3455 const staged = process . argv . includes ( '--staged' )
3556 const help = process . argv . includes ( '--help' ) || process . argv . includes ( '-h' )
3657
@@ -80,13 +101,6 @@ async function main(): Promise<void> {
80101 ...( process . platform === 'win32' && { shell : true } ) ,
81102 } ,
82103 } ,
83- {
84- args : [ 'exec' , 'tsgo' , '--noEmit' ] ,
85- command : 'pnpm' ,
86- options : {
87- ...( process . platform === 'win32' && { shell : true } ) ,
88- } ,
89- } ,
90104 {
91105 args : [ 'scripts/validation/no-link-deps.mts' ] ,
92106 command : 'node' ,
@@ -144,10 +158,17 @@ async function main(): Promise<void> {
144158 if ( failed ) {
145159 logger . error ( 'Some checks failed' )
146160 process . exitCode = 1
147- } else {
148- logger . success ( 'All checks passed' )
149- printFooter ( )
161+ return
150162 }
163+
164+ const typeCheckExitCode = await runTypeCheck ( quiet )
165+ if ( typeCheckExitCode !== 0 ) {
166+ process . exitCode = typeCheckExitCode
167+ return
168+ }
169+
170+ logger . success ( 'All checks passed' )
171+ printFooter ( )
151172 } catch ( error ) {
152173 logger . error ( `Check failed: ${ error . message } ` )
153174 process . exitCode = 1
0 commit comments