mirror of
https://github.com/denoland/deno.git
synced 2024-12-22 15:24:46 -05:00
fix: ignore workspace specifiers in package.json (#17934)
Part of #17916
This commit is contained in:
parent
484b6fe2fa
commit
5683daf1aa
1 changed files with 21 additions and 0 deletions
|
@ -44,6 +44,10 @@ pub fn get_local_package_json_version_reqs(
|
||||||
) -> Result<(), AnyError> {
|
) -> Result<(), AnyError> {
|
||||||
if let Some(deps) = deps {
|
if let Some(deps) = deps {
|
||||||
for (key, value) in deps {
|
for (key, value) in deps {
|
||||||
|
if value.starts_with("workspace:") {
|
||||||
|
// skip workspace specifiers for now
|
||||||
|
continue;
|
||||||
|
}
|
||||||
let (name, version_req) =
|
let (name, version_req) =
|
||||||
parse_dep_entry_name_and_raw_version(key, value)?;
|
parse_dep_entry_name_and_raw_version(key, value)?;
|
||||||
|
|
||||||
|
@ -203,4 +207,21 @@ mod test {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn test_get_local_package_json_version_reqs_skips_workspace_specifiers() {
|
||||||
|
let mut package_json = PackageJson::empty(PathBuf::from("/package.json"));
|
||||||
|
package_json.dependencies = Some(HashMap::from([
|
||||||
|
("test".to_string(), "1".to_string()),
|
||||||
|
("work".to_string(), "workspace:1.1.1".to_string()),
|
||||||
|
]));
|
||||||
|
let result = get_local_package_json_version_reqs(&package_json).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
result,
|
||||||
|
BTreeMap::from([(
|
||||||
|
"test".to_string(),
|
||||||
|
NpmPackageReq::from_str("test@1").unwrap()
|
||||||
|
)])
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue