chrisjowen
Custom Phoenix/Ecto generators?
Hey All,
Im probably in the minority in that I generally dislike some of the way that the Ecto/Phoenix generators work in and would like to have more control over what they produce. Im not here to argue this, and I havent enough Elixir experience to solidify my arguments againt them.
I usually avoid using them, but for a recent project I tried to get running as quickly as possible and relied on they heavily. I believe that generators are very useful for quick scaffolding and I would use them if they fit my defaults more (which change per project).
With this in mind do we have anything the elixir community that is a generator of generator such as GitHub - foundweekends/giter8: a command line tool to apply templates defined on GitHub · GitHub or https://yeoman.io/?
Note: I’m not looking at these as shining example in their respective ecosystems I have used both and disliked the experience but I have never sat down and thought what good would look like for such a tool I just have a feeling that a flexible easy to use generator would be extreemly useful for me.
Chris
First Post!
adrianrl
Hi,
I’ve used aspnet-codegenerator (extremely opinionated, but flexible) and the generator for Symfony and Laravel, (both are very opinionated, but flexible). I think Phoenix’s generator is poorly opinionated, and flexible enough; it just generates what you need without extra markup. I like being poorly opinionated, the framework shouldn’t make decisions for you, sometimes you don’t want to use Bootstrap as a CSS framework, or jQuery for client-side validation.
However the generator lacks a bit in terms of flexibility, sometimes you don’t want to generate all of the templates or you just want to start from scratch without all of the basic functionality, and for that specific things you may want to build your own generator, it doesn’t have to be perfect, just something that covers your needs.
Most Liked
LostKobrakai
You can copy the templates phoenix/priv/templates at main · phoenixframework/phoenix · GitHub into your own priv/templates folder and the mix tasks will use those. You’re free to edit them there.
type1fool
jg-made
Last Post!
OndrejValenta
I’m planning to use for our projects LLBLGen, which was originally intended for .NET projects but their generators are quite universal and they are developing their tools for at least 15 years what I can remember.
We are now investigating how ecto files actually look like for real aplications and then we’ll look into the templates.
It’s not free but it has quite powerful UI and you can pretty well set up how you want to generate your models. It can even create typed views for database views or stored procedures.
It deals only with RDBMS though and it also has some issues with postrgres custom types and enums.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #elixirconf-us
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #metaprogramming
- #security
- #hex









