NPM.Npmrc (NPM v0.6.0)

Copy Markdown View Source

Parses and analyzes .npmrc configuration files.

Supports project, user, and global .npmrc locations.

Summary

Functions

Formats .npmrc config for display.

Checks if auth token is configured.

Finds all .npmrc files for a project.

Merges multiple .npmrc configs (later overrides earlier).

Parses an .npmrc file into a map.

Reads and parses an .npmrc file from disk.

Extracts scoped registry configurations.

Functions

format(config)

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

Formats .npmrc config for display.

has_auth?(config)

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

Checks if auth token is configured.

locate(project_dir \\ ".")

@spec locate(String.t()) :: [String.t()]

Finds all .npmrc files for a project.

merge(configs)

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

Merges multiple .npmrc configs (later overrides earlier).

parse(content)

@spec parse(String.t()) :: map()

Parses an .npmrc file into a map.

read(path)

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

Reads and parses an .npmrc file from disk.

scoped_registries(config)

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

Extracts scoped registry configurations.