NPM.Import (NPM v0.6.0)

Copy Markdown View Source

Imports lockfiles from other package managers.

Converts yarn.lock, pnpm-lock.yaml metadata into npm_ex format for migration from other tools.

Summary

Functions

Detects which package manager lockfiles exist in the project.

Reads dependencies from a package-lock.json file.

Checks if migration is needed (other lockfile exists but no npm.lock).

Returns the primary package manager detected.

Functions

detect(project_dir \\ ".")

@spec detect(String.t()) :: [atom()]

Detects which package manager lockfiles exist in the project.

from_package_lock(path)

@spec from_package_lock(String.t()) :: {:ok, map()} | {:error, term()}

Reads dependencies from a package-lock.json file.

migration_needed?(project_dir \\ ".")

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

Checks if migration is needed (other lockfile exists but no npm.lock).

primary_manager(project_dir \\ ".")

@spec primary_manager(String.t()) :: atom() | nil

Returns the primary package manager detected.