mix rpc.gen.ts.watch (elixir_ts_rpc v0.0.1)

Copy Markdown View Source

Watches Elixir sources and regenerates the TypeScript client on every change.

Runs rpc.gen.ts once on startup, then re-runs it whenever a .ex file under the watched directories changes.

Each regeneration spawns a fresh mix rpc.gen.ts process. This is deliberate: an in-process Mix.Task.rerun("compile") does not pick up source edits — the Elixir compiler caches its manifest for the lifetime of the BEAM, so it reports :noop and the generated client goes stale. A separate process re-reads the manifest from disk and recompiles correctly.

Usage

mix rpc.gen.ts.watch --router MyApp.Router --out path/to/rpc.gen.ts

Accepts every option rpc.gen.ts accepts, plus:

  • --dir - a directory to watch (repeatable; defaults to lib)

Requires the optional :file_system dependency:

{:file_system, "~> 1.0", only: :dev}