Skip to content

feat: harden JS workspace glob handling with exclusions and dedup#51

Merged
thefourcraft merged 2 commits intoproductionfrom
feature/js-workspace-exclude-patterns
May 4, 2026
Merged

feat: harden JS workspace glob handling with exclusions and dedup#51
thefourcraft merged 2 commits intoproductionfrom
feature/js-workspace-exclude-patterns

Conversation

@thefourcraft
Copy link
Copy Markdown
Member

Summary

  • pnpm-workspace.yaml, lerna.json, and package.json workspaces arrays now respect !-prefixed exclusion patterns (e.g. !packages/experimental, !apps/legacy)
  • Overlapping include patterns (e.g. ["packages/*", "packages/api"]) are deduplicated via BTreeSet — first occurrence wins, deterministic order preserved
  • New internal helpers: parse_yaml_list_items, js_glob_excludes, expand_js_workspace_patterns
  • Cargo workspace detection from PR feat: harden Cargo workspace detection with TOML parsing #50 is untouched

Test plan

  • pnpm_workspace_exclude_removes_matching_member!packages/experimental excluded from pnpm workspace
  • lerna_exclude_removes_matching_member!packages/legacy excluded from lerna workspace
  • npm_workspaces_exclude_removes_matching_member!apps/legacy excluded from npm workspaces array
  • js_workspace_deduplicates_overlapping_patterns["packages/*", "packages/api"] yields packages/api exactly once
  • All 728 existing tests pass
  • cargo clippy --bin barzel -- -D warnings clean

pnpm-workspace.yaml, lerna.json, and package.json workspaces arrays now:
- Respect !-prefixed exclusion patterns (e.g. '!packages/experimental')
- Deduplicate overlapping patterns (e.g. ["packages/*", "packages/api"])
  via BTreeSet on relative path — first occurrence wins

New helpers: parse_yaml_list_items, js_glob_excludes,
expand_js_workspace_patterns.  Cargo detection from PR #50 is unchanged.
Previously the parser collected list items from every section of
pnpm-workspace.yaml.  Now it tracks whether we are inside the top-level
packages: block and stops collecting when a new top-level key appears, so
values in ignoredBuiltDependencies, catalogs, and other sections cannot
be mistaken for workspace members.
@thefourcraft thefourcraft merged commit 604dc35 into production May 4, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant