@@ -4,9 +4,22 @@ const { execSync } = require('child_process');
44
55// Run TypeScript compilation
66console . log ( 'Compiling TypeScript...' ) ;
7- const tscPath = path . join ( __dirname , '../node_modules/.bin/tsc' ) ;
8- execSync ( `${ tscPath } ` , { stdio : 'inherit' , cwd : path . join ( __dirname , '..' ) } ) ;
9- execSync ( `${ tscPath } -p tsconfig.esm.json` , { stdio : 'inherit' , cwd : path . join ( __dirname , '..' ) } ) ;
7+
8+ // Try to find tsc in different locations
9+ let tscPath = path . join ( __dirname , '../node_modules/.bin/tsc' ) ;
10+ if ( ! fs . existsSync ( tscPath ) ) {
11+ // Try workspace root
12+ tscPath = path . join ( __dirname , '../../../node_modules/.bin/tsc' ) ;
13+ }
14+ if ( ! fs . existsSync ( tscPath ) ) {
15+ // Try using npx as fallback
16+ console . log ( 'Using npx to run TypeScript compiler...' ) ;
17+ execSync ( 'npx tsc' , { stdio : 'inherit' , cwd : path . join ( __dirname , '..' ) } ) ;
18+ execSync ( 'npx tsc -p tsconfig.esm.json' , { stdio : 'inherit' , cwd : path . join ( __dirname , '..' ) } ) ;
19+ } else {
20+ execSync ( `${ tscPath } ` , { stdio : 'inherit' , cwd : path . join ( __dirname , '..' ) } ) ;
21+ execSync ( `${ tscPath } -p tsconfig.esm.json` , { stdio : 'inherit' , cwd : path . join ( __dirname , '..' ) } ) ;
22+ }
1023
1124// Rename files to have correct extensions
1225const wasmDir = path . join ( __dirname , '../wasm' ) ;
0 commit comments