showInstallProgress

tcmts.cli.ui.showInstallProgress · #hveo7pvg · term · runs on the server

uses @clack/prompts's exports, which uses node:fs

Package installs (which tcm runs as it needs them) as spinners on a terminal, not lines of text.

import { setProgress } from "#codebase/tcmts/loader/packages";
import * as p from "@clack/prompts";

export function showInstallProgress() {
  if (!process.stderr.isTTY || process.env.CI) return;
  setProgress({
    start(message) {
      // the install blocks the event loop, so no animation or timer: the line, then what happened and how long it took
      const s = p.spinner({ output: process.stderr, withGuide: false });
      s.start(message);
      return { stop: (done) => s.stop(done), fail: (why) => s.error(why) };
    },
  });
}

uses

used by