feat: folder hash#16
Merged
Merged
Conversation
Replaces the unmaintained folder-hash library with a zero-dependency implementation using node:crypto and node:fs. Walks a directory tree, hashes each file with SHA-256, sorts by relative path for deterministic ordering, then produces a single combined hex digest. Supports excludeFolders and excludeFiles options to skip build artifacts. Exports: DI abstraction (HashFolderTool/HashFolderToolFeature), factory (createHashFolderTool), and standalone function (hashFolder). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
hash() uses readdirSync/readFileSync for simple synchronous usage. hashAsync() reads files and recurses into subdirectories concurrently via Promise.all for better throughput on large directory trees. Both methods produce identical deterministic SHA-256 digests. Standalone exports: hashFolder (sync), hashFolderAsync (async). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Methods now return { hash: string } instead of a bare string,
making the return type extensible for future metadata (file count,
total size, etc.) without a breaking API change.
Also adds changeset for the patch release.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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
Add HashFolderTool to @webiny/stdlib/node as a zero-dependency replacement for the unmaintained folder-hash library.
Usage
Test plan