@@ -5,11 +5,8 @@ import process from "node:process";
55const args = process . argv . slice ( 2 ) ;
66const env = { ...process . env } ;
77const cwd = process . cwd ( ) ;
8- const compilerOverride = env . OPENCLAW_TS_COMPILER ?? env . CLAWDBOT_TS_COMPILER ;
9- const compiler = compilerOverride === "tsc" ? "tsc" : "tsgo" ;
10- const projectArgs = [ "--project" , "tsconfig.json" ] ;
118
12- const initialBuild = spawnSync ( "pnpm" , [ "exec" , compiler , ... projectArgs ] , {
9+ const initialBuild = spawnSync ( "pnpm" , [ "build" ] , {
1310 cwd,
1411 env,
1512 stdio : "inherit" ,
@@ -19,12 +16,7 @@ if (initialBuild.status !== 0) {
1916 process . exit ( initialBuild . status ?? 1 ) ;
2017}
2118
22- const watchArgs =
23- compiler === "tsc"
24- ? [ ...projectArgs , "--watch" , "--preserveWatchOutput" ]
25- : [ ...projectArgs , "--watch" ] ;
26-
27- const compilerProcess = spawn ( "pnpm" , [ "exec" , compiler , ...watchArgs ] , {
19+ const compilerProcess = spawn ( "pnpm" , [ "tsdown" , '--watch' , 'src/' ] , {
2820 cwd,
2921 env,
3022 stdio : "inherit" ,
@@ -39,7 +31,9 @@ const nodeProcess = spawn(process.execPath, ["--watch", "openclaw.mjs", ...args]
3931let exiting = false ;
4032
4133function cleanup ( code = 0 ) {
42- if ( exiting ) return ;
34+ if ( exiting ) {
35+ return ;
36+ }
4337 exiting = true ;
4438 nodeProcess . kill ( "SIGTERM" ) ;
4539 compilerProcess . kill ( "SIGTERM" ) ;
@@ -50,11 +44,15 @@ process.on("SIGINT", () => cleanup(130));
5044process . on ( "SIGTERM" , ( ) => cleanup ( 143 ) ) ;
5145
5246compilerProcess . on ( "exit" , ( code ) => {
53- if ( exiting ) return ;
47+ if ( exiting ) {
48+ return ;
49+ }
5450 cleanup ( code ?? 1 ) ;
5551} ) ;
5652
5753nodeProcess . on ( "exit" , ( code , signal ) => {
58- if ( signal || exiting ) return ;
54+ if ( signal || exiting ) {
55+ return ;
56+ }
5957 cleanup ( code ?? 1 ) ;
6058} ) ;
0 commit comments