Expand description
Zero-config project type detection.
Scans a directory for build system files (Cargo.toml, package.json, go.mod,
etc.) and returns the detected ProjectKind with ecosystem-specific
metadata. Supports 32 ecosystems out of the box.
use project_detect::{detect, ProjectKind};
if let Some(kind) = detect(".") {
println!("Detected: {} ({})", kind.label(), kind.detected_file());
}Structs§
- Workspace
Package - A package in a workspace that has a “dev” script.
Enums§
- Kotlin
Build - Kotlin build tool metadata.
- NodePM
- Node.js package manager, detected from lockfile presence.
- Project
Kind - A detected project type with ecosystem-specific metadata.
Functions§
- command_
on_ path - Check whether a command exists on
$PATH. - detect
- Detect the project kind from files in
dir. - detect_
nearest - Detect the project kind, walking up from
dirif nothing is found. - detect_
node_ workspace - Detect Node.js workspace packages that have a “dev” script.
- detect_
walk - Like
detect, but walks up the directory tree if no project is found indir. Returns the detected kind and the directory it was found in. - node_
has_ bin - Check whether a Node project’s
package.jsonhas a"bin"field. - node_
has_ script - Check whether a Node project’s
package.jsoncontains a specific script. - supported_
table - Formatted table of all supported project types for error messages.