hexpm / hex

Package manager for the Erlang ecosystem.
https://hex.pm
971 stars 185 forks source link

Add `mix hex.add PACKAGE` task #694

Closed webdeb closed 5 years ago

supersimple commented 5 years ago

hi @webdeb 👋 can you describe what this task should do? how it differs from hex.publish for instance?

thanks

webdeb commented 5 years ago

hi @supersimple, the idea is to install dependencies directly from the command line.

mix hex.add jason
# OR
mix deps.add jason

I know this would require a /deps.exs file. But would't it make sense?

supersimple commented 5 years ago

IMO using mix implies you have a mix.exs file with dependencies in it, so any task that would do this would have to modify that file (adding a dependency). In my mind it would:

  1. add a line to dependencies in the mix file
  2. run mix deps.get

Either way, I do think this issue or discussion belongs in the Elixir project https://github.com/elixir-lang/elixir/issues

wojtekmach commented 5 years ago

Hi @webdeb, this has been proposed a few times in the past, here's one example discussion about such feature: https://elixirforum.com/t/mix-deps-add-functionality/4856

TL;DR: rewriting mix.exs correctly is tricky. For this reason, I think folks should try to solve these problems in a 3rd-party tool and then potentially propose it to Hex/Elixir. Thanks!