NPM.Doctor (NPM v0.6.0)

Copy Markdown View Source

Health check for the npm installation.

Validates the project's npm setup by checking for common issues: missing files, stale lockfiles, broken symlinks, etc.

Summary

Functions

Runs all health checks and returns results.

Formats check results for display.

Returns true if all checks pass (no errors).

Returns a summary of check results.

Types

check_result()

@type check_result() :: %{
  name: String.t(),
  status: :ok | :warn | :error,
  message: String.t()
}

Functions

diagnose(project_dir \\ ".")

@spec diagnose(String.t()) :: [check_result()]

Runs all health checks and returns results.

format_results(results)

@spec format_results([check_result()]) :: String.t()

Formats check results for display.

healthy?(project_dir \\ ".")

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

Returns true if all checks pass (no errors).

summary(results)

@spec summary([check_result()]) :: %{
  ok: non_neg_integer(),
  warn: non_neg_integer(),
  error: non_neg_integer()
}

Returns a summary of check results.