Developing elixir hex package for a project, what is your suggestion?

Hi, imagine you have an elixir umbrella project, and you want to create some hex packages for your main project, and you should call some module and function into your package from your umbrella project.
Hence, after that you face several problems, like your package can not know what is your module, and it is undefined for it and the other is testing.


For example:

I have been working on an Elixir CMS, my project is umbrella, and it has a plugin system manager to let me create some plugins for every event in my project I want.
Now I want to make a plugin as hex package which is a social login and register. This plugin needs to call two sub-systems of my CMS.
In this case, I need mishka_installer and mishka_user (Apps) are used in my hex package as dependencies.

defmodule MishkaSocial.Auth.Strategy do
  alias MishkaInstaller.Reference.OnUserBeforeSave
  use MishkaInstaller.Hook,
    module: __MODULE__,
    behaviour: OnUserBeforeSave,
    event: :on_user_after_login,
    initial: []

  @spec initial(list()) :: {:ok, OnUserBeforeSave.ref(), list()}
  def initial(args) do
    event = %PluginState{name: "MishkaSocial.Auth.Strategy", event: Atom.to_string(@ref), priority: 1}
    Hook.register(event: event)
    {:ok, @ref, args}
  end

  @spec call(OnUserBeforeSave.t()) :: {:reply, OnUserBeforeSave.t()}
  def call(%OnUserBeforeSave{} = state) do
    {:reply, state}
  end
end

As you can see above, in the third line I call a macro of my project (the CMS) in the plugin, but if I want to extend it in hex package, so I have this error.

(CompileError) module MishkaInstaller.Hook is not loaded and could not be found

It forces me to develop my new plugin under my umbrella, instead of a new hex elixir project or create all the thing dynamically.

What is your suggestion for this problem?
Thank you in advance.

Hi, Any suggestion about my problem? :pensive:

Hi!

should also become hex packages.

1 Like

Yes, after researching I decided to make them as hex packages