Home / Function/ runCommand() — ui Function Reference

runCommand() — ui Function Reference

Architecture documentation for the runCommand() function in helpers.ts from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  8f2772cb_48bf_edee_e0f3_31c76c107492["runCommand()"]
  d74412ab_0ee4_22df_d4c9_26e6c03c4a41["helpers.ts"]
  8f2772cb_48bf_edee_e0f3_31c76c107492 -->|defined in| d74412ab_0ee4_22df_d4c9_26e6c03c4a41
  26ee316c_482d_d5d0_7c05_26095f85f089["npxShadcn()"]
  26ee316c_482d_d5d0_7c05_26095f85f089 -->|calls| 8f2772cb_48bf_edee_e0f3_31c76c107492
  style 8f2772cb_48bf_edee_e0f3_31c76c107492 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/tests/src/utils/helpers.ts lines 29–65

export async function runCommand(
  cwd: string,
  args: string[],
  options?: {
    env?: Record<string, string>
    input?: string
  }
) {
  try {
    const childProcess = execa("node", [SHADCN_CLI_PATH, ...args], {
      cwd,
      env: {
        ...process.env,
        FORCE_COLOR: "0",
        CI: "true",
        ...options?.env,
      },
      input: options?.input,
      reject: false,
      timeout: 30000,
    })

    const result = await childProcess

    return {
      stdout: result.stdout || "",
      stderr: result.stderr || "",
      exitCode: result.exitCode ?? 0,
    }
  } catch (error: any) {
    return {
      stdout: error.stdout || "",
      stderr: error.stderr || error.message || "",
      exitCode: error.exitCode ?? 1,
    }
  }
}

Subdomains

Called By

Frequently Asked Questions

What does runCommand() do?
runCommand() is a function in the ui codebase, defined in packages/tests/src/utils/helpers.ts.
Where is runCommand() defined?
runCommand() is defined in packages/tests/src/utils/helpers.ts at line 29.
What calls runCommand()?
runCommand() is called by 1 function(s): npxShadcn.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free