mix compile.live_vue_contract (live_vue_contract v0.3.1)

Copy Markdown View Source

Runs priv/gen.mjs (node + vue-component-meta from the host's node_modules) when the sources of the contract changed since the last run.

The sources are the .vue files under :vue_root, every project file the generator read a prop type from (it reports them back), and the optional extra globs in config :live_vue_contract, :watch. Their hash and list live in a stamp in the Mix manifest directory (_build/<env>/…), not in the contract: an edit to code no prop type touches does not run node at all.

The generator rewrites the contract only when the schemas change. Every ~H module lists the contract as an external resource, so a rewrite with equal content would recompile all of them.

Without a stamp (fresh _build) and without node, an existing contract is used as is with a warning; a missing one is an error.

Add before the Elixir compiler so ~H sees a fresh contract:

compilers: [:live_vue_contract, :phoenix_live_view] ++ Mix.compilers()