@onexapis/cli 1.1.18 → 1.1.20

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.mjs CHANGED
@@ -2497,7 +2497,7 @@ async function buildCommand(options) {
2497
2497
  logger.stopSpinner(true, "Lint passed");
2498
2498
  const pkgJson = fs.readJsonSync(packageJsonPath);
2499
2499
  const buildScript = pkgJson.scripts?.build || "";
2500
- const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex-cli build");
2500
+ const isRecursive = buildScript.includes("onexthm build") || buildScript.includes("onex build") || buildScript.includes("onex-cli build");
2501
2501
  logger.startSpinner(
2502
2502
  options.watch ? "Building (watch mode)..." : "Building..."
2503
2503
  );
@@ -2531,18 +2531,36 @@ function runCommand(command, args, cwd) {
2531
2531
  return new Promise((resolve) => {
2532
2532
  const proc = spawn(command, args, {
2533
2533
  cwd,
2534
- stdio: "pipe",
2534
+ stdio: ["pipe", "pipe", "pipe"],
2535
2535
  shell: true
2536
2536
  });
2537
- let hasError = false;
2537
+ let stdout = "";
2538
+ let stderr = "";
2539
+ proc.stdout.on("data", (data) => {
2540
+ stdout += data.toString();
2541
+ });
2538
2542
  proc.stderr.on("data", (data) => {
2539
- const message = data.toString();
2540
- if (message.includes("error") || message.includes("Error") || message.includes("ERROR")) {
2541
- hasError = true;
2542
- }
2543
+ stderr += data.toString();
2543
2544
  });
2544
2545
  proc.on("close", (code) => {
2545
- resolve(code === 0 && !hasError);
2546
+ if (code !== 0) {
2547
+ const output = (stderr + stdout).trim();
2548
+ if (output) {
2549
+ logger.newLine();
2550
+ for (const line of output.split("\n")) {
2551
+ const t = line.trim();
2552
+ if (!t) continue;
2553
+ if (t.includes("error") || t.includes("Error") || t.includes("TS")) {
2554
+ logger.log(` \u274C ${t}`);
2555
+ } else if (t.includes("warning") || t.includes("Warning")) {
2556
+ logger.log(` \u26A0\uFE0F ${t}`);
2557
+ } else {
2558
+ logger.log(` ${t}`);
2559
+ }
2560
+ }
2561
+ }
2562
+ }
2563
+ resolve(code === 0);
2546
2564
  });
2547
2565
  proc.on("error", () => {
2548
2566
  resolve(false);