diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2023-01-23 23:41:02 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-23 23:41:02 +0100 |
commit | bf237c6241f53122e37341a0dda65ef9e3b51a49 (patch) | |
tree | e352b4f60887e4d009cacdef250b7e8c294ff829 /cli/npm | |
parent | cd192313064bc2e9d65e3e734930cfaf15f4191b (diff) |
refactor: Move lockfile to a separate crate (#17503)
Moves the lockfile implementation to a separate crate so other projects
like Deploy can use it as well.
Diffstat (limited to 'cli/npm')
-rw-r--r-- | cli/npm/registry.rs | 13 | ||||
-rw-r--r-- | cli/npm/resolution/mod.rs | 7 |
2 files changed, 5 insertions, 15 deletions
diff --git a/cli/npm/registry.rs b/cli/npm/registry.rs index 0b35079de..97397350d 100644 --- a/cli/npm/registry.rs +++ b/cli/npm/registry.rs @@ -184,19 +184,6 @@ pub struct NpmPackageVersionDistInfo { } impl NpmPackageVersionDistInfo { - #[cfg(test)] - pub fn new( - tarball: String, - shasum: String, - integrity: Option<String>, - ) -> Self { - Self { - tarball, - shasum, - integrity, - } - } - pub fn integrity(&self) -> Cow<String> { self .integrity diff --git a/cli/npm/resolution/mod.rs b/cli/npm/resolution/mod.rs index c4d05598c..f10678cbe 100644 --- a/cli/npm/resolution/mod.rs +++ b/cli/npm/resolution/mod.rs @@ -397,10 +397,13 @@ impl NpmResolution { pub fn lock(&self, lockfile: &mut Lockfile) -> Result<(), AnyError> { let snapshot = self.snapshot.read(); for (package_req, package_id) in snapshot.package_reqs.iter() { - lockfile.insert_npm_specifier(package_req, package_id); + lockfile.insert_npm_specifier( + package_req.to_string(), + package_id.as_serialized(), + ); } for package in snapshot.all_packages() { - lockfile.check_or_insert_npm_package(&package)?; + lockfile.check_or_insert_npm_package(package.into())?; } Ok(()) } |