zachdaniel

zachdaniel

Creator of Ash

Igniter

Igniter is a code generation and project patching framework.

For library authors, this is a tool kit for writing smarter generators that can semantically modify existing files, and all sorts of useful tools for doing so.

For end-users, this means mix igniter.install <package>, which will add it to your mix.exs automatically and then run that library’s installer if it has one. Even when libraries don’t have an installer, or use igniter, this behavior makes it useful to keep around.

Installation

Igniter can be added to an existing elixir project by adding it to your dependencies:

{:igniter, "~> 0.1", only: [:dev]}

You can also generate new projects with igniter preinstalled, and run installers in the same command.

mix igniter.new app_name --install ash

To use this command, install the archive:

mix archive.install hex igniter_new

Patterns

Mix tasks built with igniter are both individually callable, and composable. This means that tasks can call eachother, and also end users can create and customize their own generators composing existing tasks.

Installers

Igniter will look for a task called <your_package>.install when the user runs mix igniter.install <your_package>, and will run it after installing and fetching dependencies.

Generators/Patchers

These can be run like any other mix task, or composed together. For example, lets say that you wanted to have your own Ash.Resource generator, that starts with the default mix ash.gen.resource task, but then adds or modifies files:

# in lib/mix/tasks/my_app.gen.resource.ex
defmodule Mix.Tasks.MyApp.Gen.Resource do
  use Igniter.Mix.Task

  def igniter(igniter, [resource | _] = argv) do
    resource = Igniter.Code.Module.parse(resource)
    my_special_thing = Module.concat([resource, SpecialThing])
    location = Igniter.Code.Module.proper_location(my_special_thing)

    igniter
    |> Igniter.compose_task("ash.gen.resource", argv)
    |> Igniter.create_new_elixir_file(location, """
    defmodule #{inspect(my_special_thing)} do
      # this is the special thing for #{inspect()}
    end
    """)
  end
end

Showing Posts 1 to 10

jimsynz

jimsynz

Ash Core Team

I’m so excited to see where this tool goes!

arcanemachine

arcanemachine

https://github.com/ash-project/igniter

:slight_smile:

PS. The Hex link in the badge in the GitHub README has an extra h in it.

beltranaceves

beltranaceves

This looks super sweet!

I’m making a package that chains mix tasks to generate projects from blueprints, configured from livebook smart cells.

I’ll definitely be adding Igniter to the system. If only you’d published this earlier I would’ve had a lot fewer headaches :slightly_smiling_face: :rofl:

zachdaniel

zachdaniel OP

Creator of Ash

Fixed! And thanks for posting the links. In the guide lines it says not to link to external sources but I think I took that too literally. It means “explain your package here”, not “don’t have any links pointing elsewhere” :laughing:

zachdaniel

zachdaniel OP

Creator of Ash

With mix igniter.install, you can install multiple packages at once! Use the @ symbol to specify specific versions, git/GitHub dependencies, or even path dependencies!

typesend

typesend

:clap: Kudos to @zachdaniel and everyone else that has been contributing to the Ash Framework. However you feel about adopting Ash itself, so many great libraries keep spinning out of that effort!

(If you haven’t yet, also check out Spark.)

venkatd

venkatd

Hi @zachdaniel I wanted to ask if I am trying to generate a directory of Ecto.Schema models in my project based on an open-api specification, is Igniter a good fit? Is it an intended use?

If the api changes, I would blow away and regenerate those models.

zachdaniel

zachdaniel OP

Creator of Ash

In that case, you likely do not need igniter. Only if you wanted to support changes being made to the schema files and retaining them while patching in new updates from the open api spec.

shiroyasha

shiroyasha

Awesome work! Can’t wait to try it out and try to replace some of the handwritten generators I have in our mix directory like this one https://github.com/operately/operately/blob/main/lib/mix/tasks/operately.gen.api.query.ex.

Hopefully, it could be just a drop-in replacement for what we already have, but with a polished and well thought through system.

type1fool

type1fool

Hey @zachdaniel! I’m finally taking Igniter for a spin on a set of component generators. There is already a Mix.Task that takes some EEx modules & HEEx templates and injects them into an application. It’ll be interesting to refactor that task to use Igniter.

Where I’m stuck, though, is on a task for adding deps to mix.exs. I added :igniter as a dependency in the generator repo (Constructor), and used mix igniter.gen.task your_app.task.name to generate the task code. After building and installing the archive, I run the new task and get an error:

~/projects/yolo  constructor_components ✔                                                                                            12d0h  
▶ mix constructor.install.deps
** (UndefinedFunctionError) function Igniter.Mix.Task.Info.global_options/0 is undefined (module Igniter.Mix.Task.Info is not available)
    Igniter.Mix.Task.Info.global_options()
    lib/mix/tasks/constructor.install.deps.ex:2: Mix.Tasks.Constructor.Install.Deps.run/1
    (mix 1.17.2) lib/mix/task.ex:495: anonymous fn/3 in Mix.Task.run_task/5
    (mix 1.17.2) lib/mix/cli.ex:96: Mix.CLI.run_task/2
    /Users/owen/.asdf/installs/elixir/1.17.2-otp-27/bin/mix:2: (file)
  • Inside Constructor’s mix.exs, do I need anything more than {:igniter, "~> 0.3"}?
  • Does Igniter need to be a dependency in the Yolo app?

Where Next? Top

Trending in Announcing Top

type1fool
WebAuthnLiveComponent WebAuthnComponents See this post about renaming the package. Passwordless authentication for Phoenix LiveView app...
New
GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
woylie
I released Doggo, a collection of unstyled Phoenix components. https://github.com/woylie/doggo Features Unstyled Phoenix components....
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
ahamez
Hi everyone, I’ve been working on this protobuf library for 3 years. We use it in the company I work for, EasyMile, to communicate with ...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
kip
I’ll shortly be launching Text, a nascent text analysis library. Current functionality In this early version (not ready for prime time) ...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
webofbits
With AI doing more of the implementation work, I’ve been wondering how much coding I should deliberately keep doing myself. My main conc...
#ai
New
bartblast
Hey folks, I just published a post about Hologram’s funding and where the project goes next - the short version: Curiosum as Main Spons...
New
CodeSync
:microphone: ElixirConf 2026 - Call for Talks is open! We’re heading to Chicago :united_states: :round_pushpin: In person + virtual :d...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews