mirror of
https://github.com/denoland/deno.git
synced 2024-12-21 23:04:45 -05:00
fix(npm): skip analyzing more specifiers in package.json (#17938)
This commit is contained in:
parent
d6192ce8fd
commit
b5b331e31a
1 changed files with 12 additions and 3 deletions
|
@ -44,8 +44,13 @@ pub fn get_local_package_json_version_reqs(
|
|||
) -> Result<(), AnyError> {
|
||||
if let Some(deps) = deps {
|
||||
for (key, value) in deps {
|
||||
if value.starts_with("workspace:") {
|
||||
// skip workspace specifiers for now
|
||||
if value.starts_with("workspace:")
|
||||
|| value.starts_with("file:")
|
||||
|| value.starts_with("git:")
|
||||
|| value.starts_with("http:")
|
||||
|| value.starts_with("https:")
|
||||
{
|
||||
// skip these specifiers for now
|
||||
continue;
|
||||
}
|
||||
let (name, version_req) =
|
||||
|
@ -209,11 +214,15 @@ mod test {
|
|||
}
|
||||
|
||||
#[test]
|
||||
fn test_get_local_package_json_version_reqs_skips_workspace_specifiers() {
|
||||
fn test_get_local_package_json_version_reqs_skips_certain_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()),
|
||||
("file".to_string(), "file:something".to_string()),
|
||||
("git".to_string(), "git:something".to_string()),
|
||||
("http".to_string(), "http://something".to_string()),
|
||||
("https".to_string(), "https://something".to_string()),
|
||||
]));
|
||||
let result = get_local_package_json_version_reqs(&package_json).unwrap();
|
||||
assert_eq!(
|
||||
|
|
Loading…
Reference in a new issue