# `mix coelho.install`
[🔗](https://github.com/nseaSeb/coelho/blob/main/lib/mix/tasks/coelho.install.ex#L1)

Does the four things that stand between adding the dependency and typing in
an editor.

    mix coelho.install

Which are: the browser packages Coelho's hook imports, the hook itself in
`assets/js/app.js`, the stylesheet in `assets/css/app.css`, and the
attachments migration. Every one of them is small and none of them is
guessable, which is a poor trade for the first ten minutes of trying a
library.

It changes nothing it does not have to. Run it twice and the second run
reports that everything is already there.

## What it touches

  * `assets/package.json` — the packages `coelho.js` imports, taken from
    Coelho's own `peerDependencies` so the list cannot drift from what the
    hook actually needs. Installed with `npm`, after asking
  * `assets/js/app.js` — the import, and `Coelho` added to the LiveSocket's
    `hooks`. Only when the file's shape is recognised; otherwise the two
    lines are printed for you to place
  * `assets/css/app.css` — the stylesheet, imported after the last `@import`
    already there, because CSS refuses one that follows a rule
  * `config/config.exs` — checked, never edited: esbuild resolves
    `coelho.js`'s bare imports from `deps/coelho/`, which never reaches
    `assets/node_modules` on its own. When no profile's `NODE_PATH` covers
    it, the task prints the path to add
  * `priv/repo/migrations` — `mix coelho.gen.migration`, which is the only
    part an application without attachments does not need

## Options

  * `--dry-run` — say what would change and change nothing
  * `--yes` — do not ask before installing the browser packages
  * `--no-npm` — print the command instead of running it
  * `--no-migration` — skip the attachments table

# `installer`

```elixir
@spec installer() :: {String.t(), String.t()}
```

The install command for this application, and the manager it names.

Read off the lockfile: `assets/` first, since that is where a Phoenix
application keeps its browser packages, then the project root for one that
keeps them there. npm when nothing says otherwise, which is what a
freshly generated application has.

# `packages`

```elixir
@spec packages() :: [{String.t(), String.t()}]
```

The browser packages the hook imports, as `{name, requirement}` pairs.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
