summaryrefslogtreecommitdiff
path: root/cli/args/package_json.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2023-02-24 21:16:26 -0500
committerGitHub <noreply@github.com>2023-02-25 02:16:26 +0000
commitb5b331e31ab1c46b70225d09d62703692985255a (patch)
tree6a3dc21ef99c33b4373912062f2c6a16318aad1f /cli/args/package_json.rs
parentd6192ce8fd053e5ba670b8d954bd8d8f5f040941 (diff)
fix(npm): skip analyzing more specifiers in package.json (#17938)
Diffstat (limited to 'cli/args/package_json.rs')
-rw-r--r--cli/args/package_json.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/cli/args/package_json.rs b/cli/args/package_json.rs
index 97fb97f0b..301d1b8ba 100644
--- a/cli/args/package_json.rs
+++ b/cli/args/package_json.rs
@@ -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!(