NPM.NpmrcMerge (NPM v0.6.0)

Copy Markdown View Source

Multi-layer .npmrc resolution (project → user → global).

Merges configuration from multiple .npmrc files with proper precedence.

Summary

Functions

Returns which layers exist and contribute config.

Returns the ordered list of .npmrc file paths (global → user → project).

Reads and parses a single .npmrc file.

Resolves merged configuration from all .npmrc layers.

Traces where a specific config key comes from.

Functions

active_layers(project_dir)

@spec active_layers(String.t()) :: [%{path: String.t(), keys: [String.t()]}]

Returns which layers exist and contribute config.

layers(project_dir)

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

Returns the ordered list of .npmrc file paths (global → user → project).

read_layer(path)

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

Reads and parses a single .npmrc file.

resolve(project_dir)

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

Resolves merged configuration from all .npmrc layers.

Project-level overrides user-level, which overrides global.

trace(project_dir, key)

@spec trace(String.t(), String.t()) :: {:ok, String.t(), String.t()} | :not_found

Traces where a specific config key comes from.