mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-22 06:53:01 +00:00
prefetch-npm-deps: use default value when lockfile has no deps
This commit is contained in:
parent
daec4bf734
commit
77571a847f
@ -18,23 +18,20 @@ pub(super) fn packages(content: &str) -> anyhow::Result<Vec<Package>> {
|
||||
1 => {
|
||||
let initial_url = get_initial_url()?;
|
||||
|
||||
lockfile
|
||||
.dependencies
|
||||
.map(|p| to_new_packages(p, &initial_url))
|
||||
.transpose()?
|
||||
to_new_packages(lockfile.dependencies.unwrap_or_default(), &initial_url)?
|
||||
}
|
||||
2 | 3 => lockfile.packages.map(|pkgs| {
|
||||
pkgs.into_iter()
|
||||
.filter(|(n, p)| !n.is_empty() && matches!(p.resolved, Some(UrlOrString::Url(_))))
|
||||
.map(|(n, p)| Package { name: Some(n), ..p })
|
||||
.collect()
|
||||
}),
|
||||
2 | 3 => lockfile
|
||||
.packages
|
||||
.unwrap_or_default()
|
||||
.into_iter()
|
||||
.filter(|(n, p)| !n.is_empty() && matches!(p.resolved, Some(UrlOrString::Url(_))))
|
||||
.map(|(n, p)| Package { name: Some(n), ..p })
|
||||
.collect(),
|
||||
_ => bail!(
|
||||
"We don't support lockfile version {}, please file an issue.",
|
||||
lockfile.version
|
||||
),
|
||||
}
|
||||
.expect("lockfile should have packages");
|
||||
};
|
||||
|
||||
packages.par_sort_by(|x, y| {
|
||||
x.resolved
|
||||
|
Loading…
Reference in New Issue
Block a user