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<super::javascript::PackageManager> {
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 }
23
24 pub fn uses_runtime(project_path: &Path, runtime: &str) -> bool {
26 let detection = Self::detect_primary_runtime(project_path);
27 detection.runtime.as_str() == runtime
28 }
29}