-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Description
Environment
- Elixir version (elixir -v):
1.16.0
- Phoenix version (mix deps):
1.7.10
- Operating system: macOS 14.2.1
Actual Behavior
mix phx.new foo --umbrella
cd foo_umbrella/apps
mix phx.new.web bar
cd ..
mix
There are a couple errors that occur:
- Related to the appended configuration in
config/config.exs
:config :bar, ecto_repos: [Bar.Repo], generators: [context_app: false]
Bar.Repo
should not exist in the context of specifically a web application. It is inconsistent with the generatedfoo_web
configuration:config :foo_web, ecto_repos: [Foo.Repo], generators: [context_app: :foo]
- Related to the generated
bar/test/support/conn_case.exs
file:Similar to the above, I don't believe this should exist and should instead reference the dependent support module. Also inconsistent with the generatedBar.DataCase.setup_sandbox(tags)
foo_web
config:Foo.DataCase.setup_sandbox(tags)
Expected Behavior
The app should be able to be compiled when a new web app is generated in the context of an umbrella app.
Proposed Solution
Adding something like a --depends-on
flag to the phx.new.web
generator so that the backing app can be specified in the generator. The additional context of the flag would also enable adding {:foo, in_umbrella: true},
automatically to deps
inside of bar/mix.exs
Example:
mix phx.new.web bar --depends-on foo
Resulting in:
# config/config.exs
config :bar,
ecto_repos: [Foo.Repo],
generators: [context_app: :foo]
# bar/test/support/conn_case.exs
Foo.DataCase.setup_sandbox(tags)
# bar/mix.exs
defp deps do
[
. . .
{:foo, in_umbrella: true}
]
end
Metadata
Metadata
Assignees
Labels
No labels