Creating a Custom Phoenix Project Generator

180
clicks
Creating a Custom Phoenix Project Generator

Source: victorbjorklund.com

Type: Post

This article discusses the potential redundancy in setting up new Elixir projects with Phoenix and how one can streamline the process by creating a custom version of the 'phx.new' mix task generator. It takes into consideration when it's beneficial to create such customizations and provides a step-by-step procedure on how to tailor the Phoenix generator to include the Oban library for job processing by default. The method involves copying and modifying the installer templates from the Phoenix GitHub repository, editing configurations to match the user-provided app names dynamically, and adding the necessary files and dependencies to ensure Oban is set up in the new project. It concludes by emphasizing the need to consider the trade-offs between custom generator maintenance and the convenience it offers when starting numerous projects.

© HashMerge 2024