Skip to main content

discover_workspaces

Function discover_workspaces 

Source
pub fn discover_workspaces(root: &Path) -> Vec<WorkspaceInfo>
Expand description

Discover all workspace packages in a monorepo.

Sources (additive, deduplicated by canonical path):

  1. package.json workspaces field
  2. pnpm-workspace.yaml packages field
  3. tsconfig.json references field (TypeScript project references)

Back-compat wrapper: drops any diagnostics and silently treats a malformed root package.json as “no workspaces”. New callers should use discover_workspaces_with_diagnostics to receive typed WorkspaceDiagnostic values and to surface root-malformed errors as hard exits.

This wrapper goes through the silent collector path that does NOT call emit_warn (private helper in crates/config/src/workspace/diagnostics.rs that does the tracing::warn! emission). Without that split, sibling callers in core/src/lib.rs (analyze) and core/src/discover/mod.rs (file discovery) would re-emit tracing::warn! on paths the user already excluded via ignorePatterns, because the back-compat wrapper has no access to the user’s globset.