feat: harden JS workspace glob handling with exclusions and dedup#51
Merged
thefourcraft merged 2 commits intoproductionfrom May 4, 2026
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
pnpm-workspace.yaml,lerna.json, andpackage.jsonworkspacesarrays now respect!-prefixed exclusion patterns (e.g.!packages/experimental,!apps/legacy)["packages/*", "packages/api"]) are deduplicated viaBTreeSet— first occurrence wins, deterministic order preservedparse_yaml_list_items,js_glob_excludes,expand_js_workspace_patternsTest plan
pnpm_workspace_exclude_removes_matching_member—!packages/experimentalexcluded from pnpm workspacelerna_exclude_removes_matching_member—!packages/legacyexcluded from lerna workspacenpm_workspaces_exclude_removes_matching_member—!apps/legacyexcluded from npm workspaces arrayjs_workspace_deduplicates_overlapping_patterns—["packages/*", "packages/api"]yieldspackages/apiexactly oncecargo clippy --bin barzel -- -D warningsclean