Minimal, safe mix.exs constraint editing — the bit mix deps.update can't do.
Like Renovate's mix manager, it only touches a literal {:dep, "~> x.y"}
tuple, found by a targeted regex; it never evaluates mix.exs. Anything it
can't confidently rewrite (non-~> constraints, dynamic deps, multiple
matches) is reported as a suggestion instead of edited.
Summary
Functions
Rewrites dep's constraint in contents to new_constraint. Returns
A new ~> constraint that admits version, e.g. new_constraint("2.3.1")
→ {:ok, "~> 2.3"}. Returns :error if the version can't be parsed.
The umbrella apps_path declared in a root mix.exs (e.g. {:ok, "apps"}),
or :none for a plain (non-umbrella) project. Used to discover the child
mix.exs files that may declare the dep whose constraint we want to raise.
Functions
@spec bump(String.t(), String.t(), String.t()) :: {:ok, String.t(), String.t()} | {:skip, String.t()} | :not_found | :ambiguous
Rewrites dep's constraint in contents to new_constraint. Returns:
{:ok, new_contents, old_constraint}— rewrote a single literal~>tuple{:skip, old_constraint}— found it, but it isn't a~>requirement:not_found— no literal{:dep, "…"}tuple:ambiguous— more than one match (won't guess)
A new ~> constraint that admits version, e.g. new_constraint("2.3.1")
→ {:ok, "~> 2.3"}. Returns :error if the version can't be parsed.
The umbrella apps_path declared in a root mix.exs (e.g. {:ok, "apps"}),
or :none for a plain (non-umbrella) project. Used to discover the child
mix.exs files that may declare the dep whose constraint we want to raise.