Elixir or Hex portable package format?

前端 未结 1 1441
栀梦
栀梦 2021-02-12 23:22

Is there any portable format for elixir code? Other than the obvious tar.

For example, if I wanted to provide one or more modules to a client or fellow developers on ano

相关标签:
1条回答
  • 2021-02-13 00:09

    It depends on what you want to provide.

    I will discuss three options below, all available through our build tool called Mix.

    • Hex packages source files. If you want to provide code for other developers to use in their projects, Hex is the best option because it knows how to fetch and resolve dependencies too. Call mix local.hex to install it and then mix local to see all available Hex tasks;

    • Escript allows you to bundle your whole project (including dependencies) into an executable that can be invoked from the command line. You need to have Erlang installed for escripts to work, you don't need to have Elixir installed though. Note an Escript cannot be used as a dependency by other projects.

    • Archives are basically a tar of compiled artifacts that the Erlang runtime knows how to load. Archives do not include dependencies and, in Elixir, they are used only as plugins for the Mix build tool. For example, Hex above is installed as an archive inside Mix.

    0 讨论(0)
提交回复
热议问题