ELIXIR/PHOENIX MIX TIP #2: MIX DEPS.UNLOCK

Standard

If you’re a fan of the Phoenix web framework, written in Elixir, you’ll know I blog a little about it.

Here is the long overdue second installment in my Elixir/Phoenix Mix Tips series.

As previously covered, you can use the following command to update an Elixir package hosted on package manager Hex:

mix deps.unlock out_of_date_dependency

And you can also use the handy mix deps.outdated to find out which packages require updating.

But what if you would like to clean out your mix.lock file?

You know the drill, you stumble across some tutorial to do something you’d like to add to your Phoenix app, you update dependencies, try it out, then maybe decide it’s not what you want, or worth the effort.

As outlined by Elixir creator José Valim and keeper of Hex Eric Meadows-Jönsson, you can very quickly clean out your mix.lock file by running either of these two commands:

mix deps.clean --unused --unlock

mix deps.unlock --unused

Be aware that, as Jose adds,

“a dependency that was not cleaned will have files at deps/dep_name but it won’t be part of the _build.”

Hope you enjoyed the tip(s). Any questions, tips, comments, leave a comment!

Image credit: fragrantica.com/