From 2caa9257f66ba578957ca9d2e6df40e989e5b9b0 Mon Sep 17 00:00:00 2001 From: Kushagra Agarwal Date: Sun, 8 Feb 2026 01:23:21 +0530 Subject: [PATCH] fix tsc build error issue --- packages/cli/package.json | 2 +- packages/cli/src/commands/build.ts | 28 +++++++--------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/packages/cli/package.json b/packages/cli/package.json index 2129f6b..7694526 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@leanmcp/cli", - "version": "0.5.11", + "version": "0.5.12", "description": "Command-line interface for scaffolding LeanMCP projects", "bin": { "leanmcp": "bin/leanmcp.js" diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts index e51b048..35fbca8 100644 --- a/packages/cli/src/commands/build.ts +++ b/packages/cli/src/commands/build.ts @@ -20,15 +20,14 @@ async function runTypeScriptCompiler(cwd: string): Promise { await execa('npx', ['tsc'], { cwd, preferLocal: true, - // Must use 'pipe' to capture output (default 'inherit' doesn't capture) - stdout: 'pipe', - stderr: 'pipe', - all: true, // Combine stdout + stderr into result.all + // Use inherit so tsc output displays live in terminal + stdout: 'inherit', + stderr: 'inherit', }); } catch (error: any) { - // execa includes full output in error.all when piped - const output = error.all || error.stdout || error.stderr || error.message; - throw new Error(output || `tsc exited with code ${error.exitCode}`); + // When using inherit, output is already shown in terminal + // Just throw with exit code info + throw new Error(`tsc exited with code ${error.exitCode ?? 1}`); } } @@ -103,20 +102,7 @@ export async function buildCommand() { tscSpinner.succeed('TypeScript compiled'); } catch (error) { tscSpinner.fail('TypeScript compilation failed'); - - // Display the full error output with proper formatting - const errorMessage = error instanceof Error ? error.message : String(error); - - // Log each line for proper formatting - const lines = errorMessage.split('\n'); - for (const line of lines) { - if (line.includes('error TS')) { - logger.error(line); - } else if (line.trim()) { - logger.log(line); - } - } - + // Output already shown via stderr: 'inherit', just exit process.exit(1); }