@onexapis/cli 1.1.18 → 1.1.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2534,7 +2534,7 @@ async function buildCommand(options) {
2534
2534
  exports.logger.stopSpinner(true, "Lint passed");
2535
2535
  const pkgJson = fs__default.default.readJsonSync(packageJsonPath);
2536
2536
  const buildScript = pkgJson.scripts?.build || "";
2537
- const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex-cli build");
2537
+ const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex build") || buildScript.includes("onex-cli build");
2538
2538
  exports.logger.startSpinner(
2539
2539
  options.watch ? "Building (watch mode)..." : "Building..."
2540
2540
  );
@@ -2568,18 +2568,36 @@ function runCommand(command, args, cwd) {
2568
2568
  return new Promise((resolve) => {
2569
2569
  const proc = child_process.spawn(command, args, {
2570
2570
  cwd,
2571
- stdio: "pipe",
2571
+ stdio: ["pipe", "pipe", "pipe"],
2572
2572
  shell: true
2573
2573
  });
2574
- let hasError = false;
2574
+ let stdout = "";
2575
+ let stderr = "";
2576
+ proc.stdout.on("data", (data) => {
2577
+ stdout += data.toString();
2578
+ });
2575
2579
  proc.stderr.on("data", (data) => {
2576
- const message = data.toString();
2577
- if (message.includes("error") || message.includes("Error") || message.includes("ERROR")) {
2578
- hasError = true;
2579
- }
2580
+ stderr += data.toString();
2580
2581
  });
2581
2582
  proc.on("close", (code) => {
2582
- resolve(code === 0 && !hasError);
2583
+ if (code !== 0) {
2584
+ const output = (stderr + stdout).trim();
2585
+ if (output) {
2586
+ exports.logger.newLine();
2587
+ for (const line of output.split("\n")) {
2588
+ const t = line.trim();
2589
+ if (!t) continue;
2590
+ if (t.includes("error") || t.includes("Error") || t.includes("TS")) {
2591
+ exports.logger.log(` \u274C ${t}`);
2592
+ } else if (t.includes("warning") || t.includes("Warning")) {
2593
+ exports.logger.log(` \u26A0\uFE0F ${t}`);
2594
+ } else {
2595
+ exports.logger.log(` ${t}`);
2596
+ }
2597
+ }
2598
+ }
2599
+ }
2600
+ resolve(code === 0);
2583
2601
  });
2584
2602
  proc.on("error", () => {
2585
2603
  resolve(false);