View Source mix hex.publish (Hex v2.0.6)
Publishes a new version of the package.
$ mix hex.publish
The current authenticated user will be the package owner. Only package
owners can publish the package, new owners can be added with the
mix hex.owner
task.
Packages and documentation sizes are limited to 8mb compressed, and 64mb uncompressed.
publishing-documentation
Publishing documentation
Documentation will be generated by running the mix docs
task. ex_doc
provides this task by default, but any library can be used. Or an alias can be
used to extend the documentation generation. The expected result of the task
is the generated documentation located in the doc/
directory with an
index.html
file.
The documentation will be accessible at https://hexdocs.pm/my_package/1.0.0
,
https://hexdocs.pm/my_package
will always redirect to the latest published
version.
Documentation will be built and published automatically. To publish a package
without documentation run mix hex.publish package
or to only publish documentation
run mix hex.publish docs
.
reverting-a-package
Reverting a package
A new package can be reverted or updated within 24 hours of it's initial publish, a new version of an existing package can be reverted or updated within one hour. Documentation have no limitations on when it can be updated.
To update the package simply run the mix hex.publish
task again. To revert run
mix hex.publish --revert VERSION
or to only revert the documentation run
mix hex.publish docs --revert VERSION
.
If the last version is reverted, the package is removed.
command-line-options
Command line options
--organization ORGANIZATION
- Set this for private packages belonging to an organization--yes
- Publishes the package without any confirmation prompts--dry-run
- Builds package and performs local checks without publishing, usemix hex.build --unpack
to inspect package contents before publishing--replace
- Allows overwriting an existing package version if it exists. Private packages can always be overwritten, public packages can only be overwritten within one hour after they were initially published.--revert VERSION
- Revert given version. If the last version is reverted, the package is removed.
configuration
Configuration
:app
- Package name (required).:version
- Package version (required).:deps
- List of package dependencies (see Dependencies below).:description
- Short description of the project.:package
- Hex specific configuration (see Package configuration below).
dependencies
Dependencies
Dependencies are defined in mix's dependency format. But instead of using
:git
or :path
as the SCM :package
is used.
defp deps() do
[
{:ecto, "~> 0.1.0"},
{:postgrex, "~> 0.3.0"},
{:cowboy, github: "extend/cowboy"}
]
end
As can be seen Hex package dependencies works alongside git dependencies. Important to note is that non-Hex dependencies will not be used during dependency resolution and neither will they be listed as dependencies of the package.
package-configuration
Package configuration
Additional metadata of the package can optionally be defined, but it is very recommended to do so.
:name
- Set this if the package name is not the same as the application name.:files
- List of files and directories to include in the package, can include wildcards. Defaults to["lib", "priv", ".formatter.exs", "mix.exs", "README*", "readme*", "LICENSE*", "license*", "CHANGELOG*", "changelog*", "src", "c_src", "Makefile*"]
.:exclude_patterns
- List of patterns matching files and directories to exclude from the package.:licenses
- List of licenses used by the package.:links
- Map of links relevant to the package.:build_tools
- List of build tools that can build the package. Hex will try to automatically detect the build tools based on the files in the package. If arebar
orrebar.config
file is present Hex will mark it as able to build with rebar. This detection can be overridden by setting this field.