Skip to main content

Crate project_detect

Crate project_detect 

Source
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§

WorkspacePackage
A package in a workspace that has a “dev” script.

Enums§

KotlinBuild
Kotlin build tool metadata.
NodePM
Node.js package manager, detected from lockfile presence.
ProjectKind
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 dir if 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 in dir. Returns the detected kind and the directory it was found in.
node_has_bin
Check whether a Node project’s package.json has a "bin" field.
node_has_script
Check whether a Node project’s package.json contains a specific script.
supported_table
Formatted table of all supported project types for error messages.