mix composer.new (composer v0.2.0)

Copy Markdown View Source

Sets up the current app as a composer cookbook, with a default recipe listing every built-in step:

lib/composer/<app>.ex
lib/composer/<app>/recipes/app.exs   (the recipe app/default)
lib/composer/<app>/steps/             (your own one-off steps)

The recipe lists every built-in step in a sensible order, each with a one-line description pulled from the step itself. It is data, not machinery: delete what you don't want, reorder freely, add your own steps. Run it with:

mix composer.recipe.run app/default

The cookbook module is guarded with if Code.ensure_loaded?(Composer), so the app still compiles where composer, a dev-only dependency, is absent.

Starting from a shared recipe

Pass --from with a recipe reference (from a dependency's cookbook or your local one) to copy that recipe instead of the built-in cookbook:

mix composer.new --from composer_lab:lv/base
mix composer.new --from local:phx/app

The copy becomes app/default. Unqualified {:use, ...} entries are qualified, so they still name the recipes they did in the source group. Comments in the source are not copied. The app owns and can edit its copy, while the shared recipe stays the template.

Options

  • --from REF - copy this recipe instead of the built-in cookbook
  • -c, --config - the local config directory, for --from local:...