Sets up Masu in a Phoenix application.
$ mix masu.install
$ mix masu.install --dry-run
The task edits two files:
assets/js/app.js- addsimport { Masu } from "masu"and putsMasuin thehooksof theLiveSocket. When it cannot find thenew LiveSocket(...)call, or its hooks are not an object or a variable, it changes nothing and prints the lines to add.assets/css/app.css- adds@import "../../deps/masu/priv/static/masu.css";, and the Sumi theme import as a comment. The imports follow the deps directory of the project (Mix.Project.deps_path/0) when it is notdeps/, as in an umbrella child or withMIX_DEPS_PATH. For a path dependency ({:masu, path: "../masu"}), which Mix does not copy intodeps/, the imports point at the dependency's directory instead.
Then it prints the esbuild note (the app's esbuild must resolve masu
through NODE_PATH: from deps/, or, for a path dependency, from the
directory that holds it).
The task is idempotent: it does not add what a file already has, and when there is nothing to add it says so.
Options
--dry-run- prints the changes as a diff and writes nothing.