Open maennchen opened 2 months ago
Summary from discussions with @zachdaniel and on Twitter
Igniter.Code.Module.proper_location/2
MyAppWeb.Controller.Foo
instead of MyAppWeb.FooController
and keep the paths according to normal elixir best practices.controller_name(igniter, "Foo")
MyAppWeb.FooController
MyAppWeb.Controller.Foo
Alright, so what I've come up with really might not be great. We will have to see. But we now have a Phoenix extension that uses module naming heuristics to figure out where a given newly created module ought to go. We can see where this takes us. It is possible that it will need to be reworked to be able to take the zipper contents of what is being created, to peek inside and see what's going on, etc. But for now it will have to do.
The remaining things are things I probably won't tackle in the near future. Specifically:
.controller_name
to help with this consistency. These I will add as I need them, and encourage others to do so as well.There is no seamless way to allow people to magically adopt this new standard, because they may not be using the function we provide in the first place, and relying on igniter to "do its thing". More realistically there would be some kind of migration task.
Is your feature request related to a problem? Please describe. When creating phoenix controllers, they are written to a location not adhering to the phoenix conventions.
MyAppWeb.TestController
=>lib/my_app_web/test_controller.ex
instead oflib/my_app_web/controllers/test.ex
Describe the solution you'd like
Provide
Igniter.Libs.Phoenix.proper_location/2
, and a way to override the path forIgniter.Code.Module.create_module/4
.Additionally, the modules should not be moved to their "correct" location at the end or there should be a convenient function to add it to the
do_not_move
igniter configuration.Describe alternatives you've considered
-
Express the feature either with a change to resource syntax, or with a change to the resource interface
For example
Additional context
None