# `NPM.Install.Prune`
[🔗](https://github.com/elixir-volt/npm_ex/blob/v0.7.4/lib/npm/install/prune.ex#L1)

Identifies and removes extraneous packages from node_modules.

Compares the installed packages against the lockfile to find
packages that are no longer needed.

# `prune_entry`

```elixir
@type prune_entry() :: %{
  name: String.t(),
  version: String.t() | nil,
  path: String.t(),
  reason: :not_in_lockfile | :orphaned_scope
}
```

# `dry_run`

```elixir
@spec dry_run(String.t(), map()) :: %{
  to_remove: [prune_entry()],
  count: non_neg_integer()
}
```

Performs a dry run, returning what would be removed.

# `extraneous_size`

```elixir
@spec extraneous_size([prune_entry()]) :: non_neg_integer()
```

Calculates the total disk size of extraneous packages.

# `find_extraneous`

```elixir
@spec find_extraneous(String.t(), map()) :: [prune_entry()]
```

Finds extraneous packages in node_modules that aren't in the lockfile.

# `prune!`

```elixir
@spec prune!(String.t(), map()) :: [prune_entry()]
```

Removes extraneous packages from node_modules.
Returns the list of removed entries.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
