standarbuild-detect 0.3.0

Detect project kind (Rust, Node, Bun, Deno, Python, Lua, C/C++) AND workspace kind (Cargo, Npm/Pnpm/Yarn/Bun, Deno, Go, Lerna, Nx, Turborepo, Mira) in polyglot monorepos
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Convenience entry point: build a built-in registry on the fly and run a
//! single detection on one directory. For repeated calls, build a
//! [`crate::DetectorRegistry`] once and reuse it.

use std::path::Path;

use crate::detector::{DetectorHit, DetectorRegistry};

/// Probe `dir` with the default built-in registry and return all hits.
///
/// Returns an empty `Vec` when `dir` matches no detector. Multiple hits
/// can come back when the dir is both a project and a workspace, or when
/// multiple workspace kinds coexist at the same root (Cargo + Npm in a
/// Tauri-style repo).
pub fn detect_in_dir(dir: &Path) -> Vec<DetectorHit> {
    DetectorRegistry::with_builtins().detect(dir)
}