Skip to main content

detect_runtime

Function detect_runtime 

Source
pub fn detect_runtime(context_path: impl AsRef<Path>) -> Option<Runtime>
Expand description

Detect the runtime from files in the given directory.

This function examines the project directory for characteristic files that indicate which runtime the project uses. Detection order matters: more specific runtimes (like Bun, Deno) are checked before generic ones (Node.js).

ยงExamples

use zlayer_builder::templates::detect_runtime;

let runtime = detect_runtime("/path/to/project");
if let Some(rt) = runtime {
    println!("Detected runtime: {:?}", rt);
}