Skip to main content

from_lockfile

Function from_lockfile 

Source
pub fn from_lockfile(
    package_lock: &Path,
    dest: &Path,
) -> Result<Vec<Resolved>, Box<dyn Error>>
Expand description

Install the exact dependency tree pinned by a package-lock.json into <dest>/node_modules/ — a pure-Rust, npm ci-faithful install.

The lockfile (v2/v3) is parsed by crate::package_json::lock; this installs every registry-tarball entry whose os/cpu match the host (skipping links and off-platform optional deps like darwin-only fsevents on Linux), verifies each sha512 integrity, extracts it to the path the lockfile names, and creates node_modules/.bin/ symlinks — so installed CLIs (tsc, playwright, …) run as under npm, with only the Node runtime, no npm. Skip-if-unchanged on the lockfile’s content hash. Returns the installed set, sorted by install path.