mix coelho.install (coelho v0.5.0)

Copy Markdown View Source

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
  • priv/repo/migrationsmix 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 running npm install
  • --no-npm — print the command instead of running it
  • --no-migration — skip the attachments table

Summary

Functions

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

Functions

packages()

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

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