mix hex.package (Hex v0.21.1) View Source
Fetches or diffs packages.
Fetch a package tarball to the current directory.
mix hex.package fetch PACKAGE VERSION [--unpack] [--output PATH]
You can pipe the fetched tarball to stdout by setting
mix hex.package diff APP VERSION
This command compares the project's dependency
the target package version, unpacking the target version into
temporary directory and running a diff command.
mix hex.package diff PACKAGE VERSION1 VERSION2 mix hex.package diff PACKAGE VERSION1..VERSION2
This command fetches package tarballs for both versions, unpacks them into temporary directories and runs a diff command. Afterwards, the temporary directories are automatically deleted.
Note, similarly to when tarballs are fetched with
hex_metadata.config is placed in each unpacked directory.
This file contains package's metadata as Erlang terms and so
we can additionally see the diff of that.
The exit code of the task is that of the underlying diff command.
The diff command can be customized by setting
configuration option, see
mix help hex.config for more information.
The default diff command is:
git diff --no-index __PATH1__ __PATH2__
__PATH2__ placeholders will be interpolated with
paths to directories of unpacked tarballs for each version.
Many diff commands supports coloured output but because we execute the command in non-interactive mode, they'd usually be disabled.
On Unix systems you can pipe the output to more commands, for example:
mix hex.package diff decimal 1.0.0..1.1.0 | colordiff | less -R
Here, the output of
mix hex.package diff is piped to the
utility to adds colours, which in turn is piped to
less -R which
"pages" it. (
-R preserves escape codes which allows colours to work.)
Another option is to configure the diff command itself. For example, to
force Git to always colour the output we can set the
mix hex.config diff_command "git diff --color=always --no-index __PATH1__ __PATH2__" mix hex.package diff decimal 1.0.0..1.1.0
--unpack- Unpacks the tarball after fetching it
--output- Sets output path. When used with
--unpackit means the directory (Default:
<app>-<version>). Otherwise, it specifies tarball path (Default:
--organization ORGANIZATION- Set this for private packages belonging to an organization
--repo REPO- Set this for self-hosted Hex instances, default: