NPM.CI (NPM v0.6.0)

Copy Markdown View Source

Strict frozen install for CI environments.

Implements npm ci behavior — validates lockfile matches package.json exactly, cleans node_modules, and installs from lockfile only. No lockfile modifications allowed.

Summary

Functions

Formats validation errors for display.

Determines if node_modules needs to be cleaned before install.

Checks if CI install is possible (all prerequisites met).

Validates that the lockfile is in sync with package.json.

Types

validation_error()

@type validation_error() ::
  :lockfile_missing
  | :package_json_missing
  | {:missing_dep, String.t()}
  | {:extra_dep, String.t()}

Functions

format_errors(errors)

@spec format_errors([validation_error()]) :: String.t()

Formats validation errors for display.

needs_clean?(project_dir \\ ".")

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

Determines if node_modules needs to be cleaned before install.

preflight(project_dir \\ ".")

@spec preflight(String.t()) :: :ok | {:error, [String.t()]}

Checks if CI install is possible (all prerequisites met).

validate(project_dir \\ ".")

@spec validate(String.t()) :: :ok | {:error, [validation_error()]}

Validates that the lockfile is in sync with package.json.