NPM.Install.ScriptInstall (NPM v0.7.4)

Copy Markdown View Source

Implements NPM.install/2 for script-style usage outside Mix projects.

The public NPM.install/2 API works like Mix.install/2: dependencies are resolved once per BEAM VM, installed into a content-addressed directory, and exposed through NPM.install_dir!/0 and NPM.node_modules_dir!/0.

Installs are cached by dependency map and guarded with :persistent_term so a running VM cannot accidentally switch to a different npm dependency set after code has already loaded packages from the first install.

Summary

Functions

install(deps, opts)

@spec install(
  map(),
  keyword()
) :: :ok

install_dir!()

@spec install_dir!() :: String.t()

installed?()

@spec installed?() :: boolean()

node_modules_dir!()

@spec node_modules_dir!() :: String.t()