NPM.Shrinkwrap (NPM v0.6.0)

Copy Markdown View Source

Implements npm shrinkwrap lockfile freezing.

Creates a npm-shrinkwrap.json that locks the entire dependency tree, including transitive dependencies. Unlike package-lock.json, shrinkwrap files are published with the package.

Summary

Functions

Creates a shrinkwrap file from the current lockfile.

Checks if a shrinkwrap file exists.

Checks if the shrinkwrap is outdated compared to the lockfile.

Reads and parses the shrinkwrap file.

Removes the shrinkwrap file.

Verifies that installed packages match the shrinkwrap exactly. Returns a list of mismatches.

Functions

create(project_dir \\ ".")

@spec create(String.t()) :: :ok | {:error, term()}

Creates a shrinkwrap file from the current lockfile.

exists?(project_dir \\ ".")

@spec exists?(String.t()) :: boolean()

Checks if a shrinkwrap file exists.

outdated?(project_dir \\ ".")

@spec outdated?(String.t()) :: boolean()

Checks if the shrinkwrap is outdated compared to the lockfile.

read(project_dir \\ ".")

@spec read(String.t()) :: {:ok, map()} | {:error, term()}

Reads and parses the shrinkwrap file.

remove(project_dir \\ ".")

@spec remove(String.t()) :: :ok | {:error, term()}

Removes the shrinkwrap file.

verify(shrinkwrap_deps, installed)

@spec verify(map(), map()) :: [mismatch()]

Verifies that installed packages match the shrinkwrap exactly. Returns a list of mismatches.