0.1.4 • Published 7 months ago

ink-spawn v0.1.4

Weekly downloads
-
License
ISC
Repository
github
Last release
7 months ago

ink-spawn

Component for Ink, spawning child processes.

ink-spawn combined example

<>
  <Text>Composed example</Text>
  <Script>
    <Spawn command="echo" args={["task 1", "&&", "sleep", "1"]} shell />
    <Script parallel>
      <Spawn command="echo" args={["task 2.a", "&&", "sleep", "1"]} shell />
      <Spawn command="echo" args={["task 2.b", "&&", "sleep", "1"]} shell />
    </Script>
    <Spawn command="echo" args={["task 3", "&&", "sleep", "1"]} shell />
    <Text>Bye 👋</Text>
  </Script>
</>

Features

  • The <Spawn />
    • starts executing a child process as it mounts,
    • kills the process as it unmounts and prints,
    • renders a configurable status text (running, succeeded, failed),
    • renders the last lines below the status of a running process.
    • propagates terminal interrupts (users pressing Ctrl + C)
  • The <Script />
    • Wraps <Spawn /> and any other elements element.
    • Sequential mode (default): Renders only the subset of completed children and the currently running runnable (<Spawn /> and other nested <Script />).
    • Parallel mode: Renders all children, making processes spawn in parallel.
    • Infinitely composable: Put parallel scripts, inside sequential scripts, inside ...

See examples and JSDoc comments on props for usage.

0.1.4

7 months ago

0.1.3

7 months ago

0.1.2

7 months ago

0.1.1

7 months ago

0.1.0

8 months ago