MCPcopy Create free account
hub / github.com/clockworklabs/SpacetimeDB / has_package_manager

Function has_package_manager

crates/cli/src/detect.rs:64–73  ·  view source on GitHub ↗

Check if a given `PackageManager` executable is available on `PATH`. On Windows, npm/pnpm/yarn are `.cmd` shims while bun is a `.exe`, so we check the platform-appropriate extension.

(pm: crate::spacetime_config::PackageManager)

Source from the content-addressed store, hash-verified

62/// On Windows, npm/pnpm/yarn are `.cmd` shims while bun is a `.exe`,
63/// so we check the platform-appropriate extension.
64pub(crate) fn has_package_manager(pm: crate::spacetime_config::PackageManager) -> bool {
65 let name = pm.to_string();
66 if cfg!(windows) {
67 // bun ships as bun.exe; npm, pnpm, yarn are .cmd shims
68 let ext = if name == "bun" { "exe" } else { "cmd" };
69 find_executable(format!("{name}.{ext}")).is_some()
70 } else {
71 find_executable(&name).is_some()
72 }
73}
74
75#[cfg(test)]
76mod tests {

Callers 1

Calls 2

find_executableFunction · 0.85
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…