4 `mix hex` command line goodies!

Notes

If you use Elixir, you use hex for package management. But if you’re like me, you didn’t know the incredibly helpful mix tasks available.

Here are four awesome ones:

  1. mix hex.outdated

Shows you your list of dependencies with their update status:

$ mix hex.outdated

Dependency              Current  Latest  Status
bandit                  1.6.11   1.7.0   Update possible
dns_cluster             0.1.3    0.2.0   Update not possible
ecto_sql                3.12.1   3.12.1  Up-to-date
esbuild                 0.8.2    0.10.0  Update possible
finch                   0.19.0   0.19.0  Up-to-date
floki                   0.37.1   0.37.1  Up-to-date
gettext                 0.26.2   0.26.2  Up-to-date
jason                   1.4.4    1.4.4   Up-to-date
phoenix                 1.7.21   1.7.21  Up-to-date
phoenix_ecto            4.6.3    4.6.4   Update possible
phoenix_html            4.2.1    4.2.1   Up-to-date
phoenix_live_dashboard  0.8.6    0.8.7   Update possible
phoenix_live_reload     1.5.3    1.6.0   Update possible
phoenix_live_view       1.0.9    1.0.17  Update possible
phoenix_test            0.6.0    0.6.0   Up-to-date
postgrex                0.20.0   0.20.0  Up-to-date
recon                   2.5.6    2.5.6   Up-to-date
swoosh                  1.17.10  1.19.2  Update possible
tailwind                0.2.4    0.3.1   Update possible
telemetry_metrics       0.6.2    1.1.0   Update not possible
telemetry_poller        1.1.0    1.2.0   Update possible
  1. mix hex.info (optional <package name>)

This one is a 2-for-1. Without a package name, it’ll give you version of hex installed in your system (along with Elixir/Erlang)

$ mix hex.info
Hex:    2.2.1
Elixir: 1.18.1
OTP:    27.0

If you give it a package name, it’ll tell you information about that package, including what lock version you have installed.


$ mix hex.info phoenix_test

Write pipeable, fast, and easy-to-read feature tests for your Phoenix apps in
a unified way -- regardless of whether you're testing LiveView pages or static
pages.

Config: {:phoenix_test, "~> 0.6.0"}
Locked version: 0.6.0
Releases: 0.6.0, 0.5.2, 0.5.1, 0.5.0, 0.4.2, 0.4.1, 0.4.0, 0.3.2, ...

Licenses: MIT
Links: Github: https://github.com/germsvel/phoenix_test
  1. mix hex.audit

This one will show you if you have any retired packages in your mix file. I can see this one being handy in CI!

  1. mix hex.search <package name>

No need to go to hex.pm to search for a package anymore. Curious what packages there are for dealing with, say, influxdb?

$ mix hex.search influx

Package                     Description                                            Version  URL
influxql                    InfluxQL utility/tooling package                       0.2.1    https://hex.pm/packages/influxql
exometer_influxdb           InfluxDB reporter for exometer                         0.6.0    https://hex.pm/packages/exometer_influxdb
telemetry_influxdb          Telemetry.Metrics reporter for InfluxDB                0.2.0    https://hex.pm/packages/telemetry_influxdb
influx_udp                  InfluxDB UDP writer                                    1.1.2    https://hex.pm/packages/influx_udp
influxdb                    InfluxDB client library                                0.2.1    https://hex.pm/packages/influxdb
telemetry_metrics_influxdb  A generic Telemetry reporter for InfluxDB/Telegraf...  1.0.0    https://hex.pm/packages/telemetry_metrics_influxdb
influx_telemetry_reporter   A generic Telemetry reporter for InfluxDB/Telegraf...  0.1.2    https://hex.pm/packages/influx_telemetry_reporter
influx_ex                   InfluxDB v2.x API library                              0.3.1    https://hex.pm/packages/influx_ex
flux_influxdb               Manage InfluxDB data                                   0.0.3    https://hex.pm/packages/flux_influxdb
influx                      InfluxDB driver for Elixir.                            0.0.1    https://hex.pm/packages/influx

I don’t know about you, but I love these little helpers!

If you want to see everything available, just type mix hex!

Want the latest Elixir Streams in your inbox?

    No spam. Unsubscribe any time.