Starter.Versions (starter v0.2.1)

Copy Markdown View Source

Fetches latest package versions from Hex and npm so generated dependencies start current instead of pinned to whatever Starter shipped with.

Lookups are cached per-run via :persistent_term and degrade gracefully: when the network is unavailable (or config :starter, fetch_versions: false is set, as in tests), version requirements fall back to permissive ranges.

Summary

Functions

Fetches the latest release tag of a GitHub repo, e.g. "v4.8.0", or nil.

Fetches the latest stable version string of a Hex package, or nil.

Fetches the latest version string of an npm package, or nil.

Fetches latest npm versions for multiple packages in parallel.

Fetches the latest Oban Pro version, or nil.

Returns a dep tuple for the latest Hex version, e.g. {:oban, "~> 2.19"}.

Builds a safe ~> requirement for a version.

Functions

fetch_github_tag(owner, repo)

Fetches the latest release tag of a GitHub repo, e.g. "v4.8.0", or nil.

fetch_hex_version(package)

Fetches the latest stable version string of a Hex package, or nil.

fetch_npm_version(package)

Fetches the latest version string of an npm package, or nil.

fetch_npm_versions(packages)

Fetches latest npm versions for multiple packages in parallel.

Packages whose lookup fails or times out map to nil — a hung registry can never crash the caller.

fetch_oban_pro_version()

Fetches the latest Oban Pro version, or nil.

Oban Pro lives on a private Hex repo, so hex.pm knows nothing about it — but the public docs site embeds the version it was built from.

latest_hex_dep(package)

Returns a dep tuple for the latest Hex version, e.g. {:oban, "~> 2.19"}.

requirement(version)

Builds a safe ~> requirement for a version.

Pre-1.0 versions keep all three segments ("0.3.1""~> 0.3.1") because 0.x minor bumps are breaking under SemVer convention; stable versions pin to the minor series ("2.19.4""~> 2.19").