NPM.Deprecation (NPM v0.6.0)

Copy Markdown View Source

Detects and reports deprecated packages in the dependency tree.

Checks the deprecated field from package metadata to warn users about packages that should be replaced.

Summary

Functions

Checks a lockfile against registry metadata for deprecation notices.

Checks if a package is deprecated.

Extracts the deprecation message from a package.json data map.

Formats a deprecation entry as a warning string.

Scans node_modules for deprecated packages.

Types

deprecation_entry()

@type deprecation_entry() :: %{
  package: String.t(),
  version: String.t(),
  message: String.t()
}

Functions

check(lockfile, metadata)

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

Checks a lockfile against registry metadata for deprecation notices.

Takes a map of %{package_name => %{deprecated: message | nil, ...}}.

deprecated?(arg1)

@spec deprecated?(map()) :: boolean()

Checks if a package is deprecated.

extract(arg1)

@spec extract(map()) :: String.t() | nil

Extracts the deprecation message from a package.json data map.

format_warning(entry)

@spec format_warning(deprecation_entry()) :: String.t()

Formats a deprecation entry as a warning string.

scan(node_modules_dir)

@spec scan(String.t()) :: [deprecation_entry()]

Scans node_modules for deprecated packages.