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

Copy Markdown View Source

Watches Elixir sources and regenerates the TypeScript client on change.

Runs rpc.gen.ts once on startup. Then re-runs it when a .ex file under a watched directory changes. Each run spawns a fresh mix rpc.gen.ts process.

The fresh process is deliberate. An in-process Mix.Task.rerun("compile") misses source edits. The Elixir compiler caches its manifest for the lifetime of the BEAM. 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}