From 172405e7a9d36fe5425e0d835db2e5fdf4dfa702 Mon Sep 17 00:00:00 2001 From: Gilad Leifman Date: Sun, 8 Mar 2026 17:24:27 -0400 Subject: [PATCH 1/2] Use local tsdown binary for server build command - Resolve `tsdown` from `apps/server/node_modules/.bin` before running build - Support Windows binary variants (`.exe`, `.cmd`) and fail with a clear error if missing --- apps/server/scripts/cli.ts | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/apps/server/scripts/cli.ts b/apps/server/scripts/cli.ts index ccf1f5a91a..6158bac32c 100644 --- a/apps/server/scripts/cli.ts +++ b/apps/server/scripts/cli.ts @@ -32,6 +32,27 @@ const runCommand = Effect.fn("runCommand")(function* (command: ChildProcess.Comm } }); +const resolveLocalTsdownCommand = Effect.fn("resolveLocalTsdownCommand")(function* ( + serverDir: string, +) { + const path = yield* Path.Path; + const fs = yield* FileSystem.FileSystem; + const binDir = path.join(serverDir, "node_modules/.bin"); + const candidates = + process.platform === "win32" ? ["tsdown.exe", "tsdown.cmd", "tsdown"] : ["tsdown"]; + + for (const candidate of candidates) { + const commandPath = path.join(binDir, candidate); + if (yield* fs.exists(commandPath)) { + return commandPath; + } + } + + return yield* new CliError({ + message: `Missing tsdown binary in ${binDir}. Install dependencies and try again.`, + }); +}); + interface PublishIconBackup { readonly targetPath: string; readonly backupPath: string; @@ -125,14 +146,15 @@ const buildCmd = Command.make( const fs = yield* FileSystem.FileSystem; const repoRoot = yield* RepoRoot; const serverDir = path.join(repoRoot, "apps/server"); + const tsdownCommand = yield* resolveLocalTsdownCommand(serverDir); yield* Effect.log("[cli] Running tsdown..."); yield* runCommand( - ChildProcess.make({ + ChildProcess.make(tsdownCommand, [], { cwd: serverDir, stdout: config.verbose ? "inherit" : "ignore", stderr: "inherit", - })`bun tsdown`, + }), ); const webDist = path.join(repoRoot, "apps/web/dist"); From 6a720ed6cb6dff82f1d740ca5451f630c00dcb65 Mon Sep 17 00:00:00 2001 From: Gilad Leifman Date: Sun, 8 Mar 2026 18:00:12 -0400 Subject: [PATCH 2/2] works like this as well --- apps/server/scripts/cli.ts | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) diff --git a/apps/server/scripts/cli.ts b/apps/server/scripts/cli.ts index 6158bac32c..4a9c923822 100644 --- a/apps/server/scripts/cli.ts +++ b/apps/server/scripts/cli.ts @@ -32,27 +32,6 @@ const runCommand = Effect.fn("runCommand")(function* (command: ChildProcess.Comm } }); -const resolveLocalTsdownCommand = Effect.fn("resolveLocalTsdownCommand")(function* ( - serverDir: string, -) { - const path = yield* Path.Path; - const fs = yield* FileSystem.FileSystem; - const binDir = path.join(serverDir, "node_modules/.bin"); - const candidates = - process.platform === "win32" ? ["tsdown.exe", "tsdown.cmd", "tsdown"] : ["tsdown"]; - - for (const candidate of candidates) { - const commandPath = path.join(binDir, candidate); - if (yield* fs.exists(commandPath)) { - return commandPath; - } - } - - return yield* new CliError({ - message: `Missing tsdown binary in ${binDir}. Install dependencies and try again.`, - }); -}); - interface PublishIconBackup { readonly targetPath: string; readonly backupPath: string; @@ -146,15 +125,15 @@ const buildCmd = Command.make( const fs = yield* FileSystem.FileSystem; const repoRoot = yield* RepoRoot; const serverDir = path.join(repoRoot, "apps/server"); - const tsdownCommand = yield* resolveLocalTsdownCommand(serverDir); yield* Effect.log("[cli] Running tsdown..."); yield* runCommand( - ChildProcess.make(tsdownCommand, [], { + ChildProcess.make({ cwd: serverDir, + shell: process.platform === "win32", stdout: config.verbose ? "inherit" : "ignore", stderr: "inherit", - }), + })`bun tsdown`, ); const webDist = path.join(repoRoot, "apps/web/dist");