diff --git a/bin/builders/BaseBuilder.ts b/bin/builders/BaseBuilder.ts index e3e7cbb..4d4ab81 100644 --- a/bin/builders/BaseBuilder.ts +++ b/bin/builders/BaseBuilder.ts @@ -120,15 +120,17 @@ export default abstract class BaseBuilder { const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml'); await fsExtra.copy(projectCnConf, projectConf); await shellExec( - `cd "${npmDirectory}" && ${packageManager} install${registryOption}${peerDepsOption} --silent`, + `cd "${npmDirectory}" && ${packageManager} install${registryOption}${peerDepsOption}`, timeout, buildEnv, + this.options.debug, ); } else { await shellExec( - `cd "${npmDirectory}" && ${packageManager} install${peerDepsOption} --silent`, + `cd "${npmDirectory}" && ${packageManager} install${peerDepsOption}`, timeout, buildEnv, + this.options.debug, ); } spinner.succeed(chalk.green('Package installed!')); diff --git a/bin/helpers/rust.ts b/bin/helpers/rust.ts index a1b4434..4dfb6ee 100644 --- a/bin/helpers/rust.ts +++ b/bin/helpers/rust.ts @@ -81,6 +81,9 @@ export async function installRust() { try { await shellExec( IS_WIN ? rustInstallScriptForWindows : rustInstallScriptForMac, + 300000, + undefined, + true, ); spinner.succeed(chalk.green('✔ Rust installed successfully!')); ensureRustEnv(); diff --git a/bin/utils/shell.ts b/bin/utils/shell.ts index b976bdd..09c3b1f 100644 --- a/bin/utils/shell.ts +++ b/bin/utils/shell.ts @@ -5,11 +5,12 @@ export async function shellExec( command: string, timeout: number = 300000, env?: Record, + showOutput: boolean = false, ) { try { const { exitCode } = await execa(command, { cwd: npmDirectory, - stdio: ['inherit', 'pipe', 'inherit'], // Hide stdout verbose, keep stderr + stdio: showOutput ? 'inherit' : ['inherit', 'pipe', 'inherit'], shell: true, timeout, env: env ? { ...process.env, ...env } : process.env, diff --git a/dist/cli.js b/dist/cli.js index 142802d..5aaceb6 100755 --- a/dist/cli.js +++ b/dist/cli.js @@ -201,11 +201,11 @@ const IS_MAC = platform$1 === 'darwin'; const IS_WIN = platform$1 === 'win32'; const IS_LINUX = platform$1 === 'linux'; -async function shellExec(command, timeout = 300000, env) { +async function shellExec(command, timeout = 300000, env, showOutput = false) { try { const { exitCode } = await execa(command, { cwd: npmDirectory, - stdio: ['inherit', 'pipe', 'inherit'], // Hide stdout verbose, keep stderr + stdio: showOutput ? 'inherit' : ['inherit', 'pipe', 'inherit'], shell: true, timeout, env: env ? { ...process.env, ...env } : process.env, @@ -340,7 +340,7 @@ async function installRust() { const rustInstallScriptForWindows = 'winget install --id Rustlang.Rustup'; const spinner = getSpinner('Downloading Rust...'); try { - await shellExec(IS_WIN ? rustInstallScriptForWindows : rustInstallScriptForMac); + await shellExec(IS_WIN ? rustInstallScriptForWindows : rustInstallScriptForMac, 300000, undefined, true); spinner.succeed(chalk.green('✔ Rust installed successfully!')); ensureRustEnv(); } @@ -756,10 +756,10 @@ class BaseBuilder { logger.info(`✺ Located in China, using ${packageManager}/rsProxy CN mirror.`); const projectCnConf = path.join(tauriSrcPath, 'rust_proxy.toml'); await fsExtra.copy(projectCnConf, projectConf); - await shellExec(`cd "${npmDirectory}" && ${packageManager} install${registryOption}${peerDepsOption} --silent`, timeout, buildEnv); + await shellExec(`cd "${npmDirectory}" && ${packageManager} install${registryOption}${peerDepsOption}`, timeout, buildEnv, this.options.debug); } else { - await shellExec(`cd "${npmDirectory}" && ${packageManager} install${peerDepsOption} --silent`, timeout, buildEnv); + await shellExec(`cd "${npmDirectory}" && ${packageManager} install${peerDepsOption}`, timeout, buildEnv, this.options.debug); } spinner.succeed(chalk.green('Package installed!')); if (!tauriTargetPathExists) {