New Phoenix 1.3 umbrella generators

Hello all!
I have generated a new project in 1.3 with mix phx.new application --umbrella and it would be nice when running mix phx.gen.html or mix phx.gen.json, have all the Domain’s stuffs & the web’s stuffs in their respective folders.
is it a forgotten feature? or is there another way?

1 Like

There is an open issue for this in Phoenix’ issues tracker.

1 Like

I’m guessing it’s this issue: https://github.com/phoenixframework/phoenix/issues/2139

3 Likes

Is this the reason why I’m seeing the following behavior?

  1. There is a phx.gen.schema in the top level of the umbrella.
  2. When I run it, I see an error: mix phx.gen.schema can only be run inside an application directory
  3. But in my apps/scratch directory, mix phx.gen.schema is not available. (None of the phx tasks are, except phx.new.)

This happens immediately after mix phx.new scratch --umbrella.

1 Like

@marick new generators in umbrella are still under development, there’s an issue for it [1]. To try them out, you need to go to apps/scratch_web (or however your web app is called) and then run the new generators. Note, the generator will create schema and context files in the wrong place for now which is what [1] will fix.

[1] https://github.com/phoenixframework/phoenix/issues/2139

1 Like

Whats the work flow with the new phx.new --umbrella generator. When I’m in the ecto project I don’t seen anything to create a context or schema. I can create them in the web project, but then I have to move them to the ecto app and change the namespace.

Is that the work flow?

I believe it’s not released yet in a rc but you’d run the generators from the web app and they’d be aware of the context app (via e.g. config :dummy_web, :generators, context_app: :dummy) and will create the files in the correct places. This would apply to all generators like gen.json, gen.context etc

2 Likes

Good to hear. Saves me writing my own mix task. Thanks…

1 Like