NPM.Dependency.Outdated (NPM v0.7.4)

Copy Markdown View Source

Checks for outdated packages by comparing installed versions against the latest available versions on the registry.

Summary

Functions

Checks a lockfile against wanted ranges and latest versions.

Computes all available updates from {name, current, latest} tuples.

Filters outdated entries by update type.

Formats updates for display.

Formats an outdated entry as a human-readable string.

Groups updates by type.

Returns a summary of outdated packages.

Classifies an update type.

Types

outdated_entry()

@type outdated_entry() :: %{
  name: String.t(),
  current: String.t(),
  wanted: String.t(),
  latest: String.t(),
  type: :major | :minor | :patch | :current
}

Functions

check(lockfile, deps, latest_versions)

@spec check(map(), map(), map()) :: [outdated_entry()]

Checks a lockfile against wanted ranges and latest versions.

Given a lockfile (installed versions) and deps (wanted ranges from package.json), and a map of latest versions from the registry, returns a list of outdated entries.

compute(packages)

@spec compute([{String.t(), String.t(), String.t()}]) :: [map()]

Computes all available updates from {name, current, latest} tuples.

filter_by_type(entries, type)

@spec filter_by_type([outdated_entry()], :major | :minor | :patch) :: [
  outdated_entry()
]

Filters outdated entries by update type.

format(updates)

@spec format([map()]) :: String.t()

Formats updates for display.

format_entry(entry)

@spec format_entry(outdated_entry()) :: String.t()

Formats an outdated entry as a human-readable string.

group_by_type(updates)

@spec group_by_type([map()]) :: map()

Groups updates by type.

summary(entries)

@spec summary([outdated_entry()] | [map()]) :: %{
  total: non_neg_integer(),
  major: non_neg_integer(),
  minor: non_neg_integer(),
  patch: non_neg_integer()
}

Returns a summary of outdated packages.

update_type(current, latest)

@spec update_type(String.t(), String.t()) :: :major | :minor | :patch | :current

Classifies an update type.