syncable_cli/analyzer/runtime/
detection.rs1use super::javascript::{RuntimeDetectionResult};
2use std::path::Path;
3
4pub struct RuntimeDetectionEngine;
6
7impl RuntimeDetectionEngine {
8 pub fn detect_primary_runtime(project_path: &Path) -> RuntimeDetectionResult {
10 use super::javascript::RuntimeDetector;
11
12 let js_detector = RuntimeDetector::new(project_path.to_path_buf());
13 js_detector.detect_js_runtime_and_package_manager()
14 }
15
16 pub fn get_all_package_managers(project_path: &Path) -> Vec<String> {
18 use super::javascript::RuntimeDetector;
19
20 let js_detector = RuntimeDetector::new(project_path.to_path_buf());
21 js_detector.detect_all_package_managers()
22 .into_iter()
23 .map(|pm| pm.as_str().to_string())
24 .collect()
25 }
26
27 pub fn uses_runtime(project_path: &Path, runtime: &str) -> bool {
29 let detection = Self::detect_primary_runtime(project_path);
30 detection.runtime.as_str() == runtime
31 }
32}