NPM.BinResolver (NPM v0.6.0)

Copy Markdown View Source

Resolve executable binaries from node_modules/.bin/.

Provides lookup and listing of available npm binaries, matching the behavior of npx and npm exec.

Summary

Functions

Check if a binary command is available.

Find the path to a specific binary command.

List all available binaries in node_modules/.bin/.

Functions

available?(command, node_modules_dir \\ "node_modules")

@spec available?(String.t(), String.t()) :: boolean()

Check if a binary command is available.

find(command, node_modules_dir \\ "node_modules")

@spec find(String.t(), String.t()) :: {:ok, String.t()} | :error

Find the path to a specific binary command.

Returns {:ok, path} if found, :error if not.

list(node_modules_dir \\ "node_modules")

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

List all available binaries in node_modules/.bin/.

Returns a sorted list of {command_name, target_path} tuples.