1
votes

If you're familiar with Rails, there's test/dummy rails app inside Engine plugins that's used for testing and whatnot.

How would I go about including something like that my library? I need that phoenix app so I can work with a view that renders some data from Ecto models. I don't want that dummy app to be compiled with the rest of my library. I could technically make a separate repo, but I wonder is there's a better way.

1

1 Answers

1
votes

If it's purely for development purpose, it would be the best of you create a Phoenix app in umbrella mode and add your library as normal umbrella child app.

That way, you can use Phoenix but it is completely decoupled from your lib and just uses your lib as a dependency as any other user would do.

Example commands to set it up:

mix phx.new my_lib_dev --umbrella

cd my_lib_dev_umbrella/apps

mix new my_lib

Then in my_lib_dev_umbrella/apps/my_lib_dev_web/mix.exs you can add your lib as dependency with {:my_lib, in_umbrella: true}.

Now you are able to develop your lib in my_lib_dev_umbrella/apps/my_lib, completely decoupled from Phoenix itself but your Phoenix setup includes it as dependency and behaves as it would have been pulled by a user from Hex.

If you are new to umbrella setups, you can read more about it here: Umbrella Projects ยท Elixir School