Skip to content

refactor: replace glob dependency with custom glob using node:fs#587

Closed
oldregime wants to merge 3 commits into
fastify:mainfrom
oldregime:replace-glob-with-builtin-fs
Closed

refactor: replace glob dependency with custom glob using node:fs#587
oldregime wants to merge 3 commits into
fastify:mainfrom
oldregime:replace-glob-with-builtin-fs

Conversation

@oldregime

Copy link
Copy Markdown

This PR removes the external glob dependency to reduce the package footprint, resolving issue #551.

Since Node's native fs.promises.glob has some limitations (like not following symlinked directories and inconsistent globstar pattern behavior on certain Node versions), we implement a small, robust custom directory walker in lib/glob.js that mimics the expected interface.

Changes:

  1. Implemented a zero-dependency recursive directory walker in lib/glob.js with support for globIgnore pattern-matching, dotfiles, and symlinks.
  2. Updated index.js to require ./lib/glob instead of glob and removed the dependency from package.json.
  3. Updated the proxyquire mock in the tests to stub ./lib/glob instead of glob, and added additional test cases to cover the callback/promise patterns and error cases of the custom glob utility to achieve 100% code coverage.

@Fdawgs

Fdawgs commented Jun 16, 2026

Copy link
Copy Markdown
Member

Duplicate of #571

@Fdawgs Fdawgs marked this as a duplicate of #571 Jun 16, 2026
@Fdawgs Fdawgs closed this Jun 16, 2026
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.

2 participants