Open kyleboe opened 8 months ago
I'm happy to open a PR for the proposed solution. Just want to see if there is a more apt name than depends-on
or if there is some configuration I am missing.
I'm a dummy. That's what the --app
flag does.
Ok actually I'm not as dumb as I thought (what a sentence).
There are some subtle differences that should be addressed. When passing the --app
flag there are other collisions in the generator.
Please share the details of the collisions you hit. Thanks!
Ah yeah sorry I've been working on the PR to fix it. The collisions were in the generated app name. While the parent folder reflects the name passed as the argument (bar
in my example) the contents the folder reflect value of the --app
flag.
The most clear example of this was in the apps/bar/mix.exs
that started with:
defmodule Foo.MixProject do
As well as apps/bar/lib/foo.ex
PR #5691 fixes things in the context of the test suite as well as local manual testing.
Environment
1.16.0
1.7.10
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:
config/config.exs
:Bar.Repo
should not exist in the context of specifically a web application. It is inconsistent with the generatedfoo_web
configuration: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 generated
foo_web
config: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 thephx.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 todeps
inside ofbar/mix.exs
Example:
Resulting in: