Skip to content

Conversation

@tylerbutler
Copy link
Member

@tylerbutler tylerbutler commented Dec 8, 2025

Unifies glob and pattern matching libraries across build-tools:

  • Replace glob, globby, and minimatch with tinyglobby and picomatch
  • Add ignore package for gitignore filtering (tinyglobby doesn't support it directly)
  • Add tests for picomatch branch matching in repoConfig

tylerbutler and others added 22 commits December 1, 2025 15:18
This change adds tests to reduce risk when implementing the glob library
consolidation described in plans/dependency-reduction.md.

Changes:
- Extract globWithGitignore function from LeafTask for testability
- Add comprehensive tests for globFn wrapper (nodir, dot, ignore, cwd, absolute options)
- Add tests for globWithGitignore gitignore behavior
- Add test data files for gitignore pattern testing

The globWithGitignore function encapsulates the globby usage with gitignore
support, making it easier to migrate to tinyglobby in the future. When
migrating, only this function needs to change, and the tests will verify
the behavior is preserved.
- Fix globPatterns.test.ts: Update glob pattern from *.js to *.mjs to match actual test file
- Fix globPatterns.test.ts: Add beforeEach/afterEach hooks to dynamically create/cleanup gitignored test files
- Fix canonicalizeChangesets.test.ts: Serialize git operations to avoid index.lock race conditions

All 703 tests now passing.
- Replace glob and globby with tinyglobby in @fluidframework/build-tools
- Replace globby with tinyglobby and add ignore for gitignore support in @fluid-tools/build-infrastructure
- Replace globby with tinyglobby and minimatch with picomatch in @fluid-tools/build-cli
- Update package.json dependencies for all affected packages
- Add @types/picomatch dev dependency
- All existing tests pass (only pre-existing environment-specific failures)

Co-authored-by: tylerbutler <[email protected]>
- Rename import to createIgnore to avoid conflict with ignore option
- Update comment about trailing slash removal to be more specific

Co-authored-by: tylerbutler <[email protected]>
…ault

- Add per-path caching for gitignore patterns in taskUtils.ts and workspaceCompat.ts
- Add unit tests for getRunPolicyCheckDefault to verify picomatch integration

Co-authored-by: tylerbutler <[email protected]>
# Conflicts:
#	build-tools/packages/build-tools/src/fluidBuild/tasks/taskUtils.ts
#	build-tools/packages/build-tools/src/test/data/glob/.gitignore
#	build-tools/packages/build-tools/src/test/globPatterns.test.ts
#	build-tools/pnpm-lock.yaml
@tylerbutler tylerbutler marked this pull request as ready for review December 18, 2025 02:23
@tylerbutler tylerbutler requested review from a team and Copilot December 18, 2025 02:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors glob and pattern matching libraries across the build-tools packages to consolidate on modern, lightweight alternatives. The changes replace glob, globby, and minimatch with tinyglobby and picomatch, while adding the ignore package for gitignore filtering functionality that was previously handled by globby.

Key changes:

  • Migrate from glob/globby to tinyglobby for file globbing operations
  • Replace minimatch with picomatch for pattern matching
  • Implement custom gitignore filtering using the ignore package
  • Add pipeline configuration for test order randomization
  • Include comprehensive tests for picomatch branch matching behavior

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
build-tools/pnpm-lock.yaml Updates lockfile to reflect new dependencies (tinyglobby, picomatch, ignore) and removal of old ones (glob, globby, minimatch)
build-tools/packages/build-tools/package.json Removes glob/globby dependencies, adds tinyglobby and ignore
build-tools/packages/build-tools/src/fluidBuild/tasks/taskUtils.ts Refactors globFn and globWithGitignore to use tinyglobby; implements custom gitignore filtering with the ignore package; adds test randomization support
build-tools/packages/build-infrastructure/package.json Replaces globby with tinyglobby and ignore
build-tools/packages/build-infrastructure/src/workspaceCompat.ts Migrates from globby to tinyglobby with custom synchronous gitignore filtering
build-tools/packages/build-cli/package.json Removes globby and minimatch, adds tinyglobby and picomatch with type definitions
build-tools/packages/build-cli/src/repoConfig.ts Replaces minimatch with picomatch for branch pattern matching
build-tools/packages/build-cli/src/library/changesets.ts Updates import from globby to tinyglobby for changeset file discovery
build-tools/packages/build-cli/src/commands/publish/tarballs.ts Migrates from globby to tinyglobby for tarball file discovery
build-tools/packages/build-cli/src/test/library/repoConfig.test.ts Adds comprehensive test coverage for picomatch-based branch pattern matching
tools/pipelines/build-client.yml Adds FLUID_BUILD_TEST_RANDOM_ORDER environment variable to enable test order randomization for fluid-build
Files not reviewed (1)
  • build-tools/pnpm-lock.yaml: Language not supported

…structure

Move gitignore filtering utilities to a shared module in build-infrastructure:
- Create gitignore.ts with toPosixPath, filterByGitignore, filterByGitignoreSync,
  globWithGitignore, and clearGitignoreRuleSetsCache functions
- Update workspaceCompat.ts to use the shared module
- Add CJS build support via tsconfig.cjs.json and build:commonjs script
- Add comments to build-tools explaining the duplication is needed because
  build-tools is CommonJS and cannot import from ESM-only build-infrastructure
@tylerbutler tylerbutler marked this pull request as draft January 8, 2026 01:09
…uild-tools

- Change type alias to interface for GitignoreRuleSet (consistent-type-definitions)
- Replace while(true) with for(;;) to avoid no-constant-condition errors
- Reorder ternary to avoid negated condition (unicorn/no-negated-condition)
- Replace @module with @packageDocumentation for valid TSDoc tag
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