refactor: replace external dependencies with Node.js built-ins#189
Open
MarshallOfSound wants to merge 4 commits intomainfrom
Open
refactor: replace external dependencies with Node.js built-ins#189MarshallOfSound wants to merge 4 commits intomainfrom
MarshallOfSound wants to merge 4 commits intomainfrom
Conversation
Replace @malept/cross-spawn-promise with child_process.execFile, debug with util.debuglog, minimatch with path.matchesGlob (Node 22), dir-compare with a simple recursive comparison, and plist with macOS plutil command. This eliminates ~22 transitive packages, leaving @electron/asar as the sole production dependency. https://claude.ai/code/session_0112RFfDPLMXemxFs6qcKf27
Restore debug and plist imports/usage per review feedback. The final set of removed dependencies is: @malept/cross-spawn-promise, dir-compare, and minimatch. https://claude.ai/code/session_0112RFfDPLMXemxFs6qcKf27
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Extract compareDirectories and matchGlob into file-utils.ts as shared exports, deduplicating the matchBase logic from 3 files. Add tests covering: identical/distinct/left-only/right-only files, nested dirs, symlinks, empty dirs, and matchBase vs full-path glob patterns. https://claude.ai/code/session_0112RFfDPLMXemxFs6qcKf27
When readdir returns a symlink entry, isDirectory() returns false even if the symlink target is a directory. Stat the resolved path to determine the actual type, so symlinked directories are traversed instead of read as files (EISDIR). https://claude.ai/code/session_0112RFfDPLMXemxFs6qcKf27
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.
This PR removes 3 production dependencies by replacing them with Node.js built-in equivalents, reducing the transitive dependency footprint.
Summary
@malept/cross-spawn-promise→promisify(execFile)fromnode:child_process. Also replacedspawn('mv', ...)with the existingfsMove()utility.minimatch→path.matchesGlob()(stable in Node.js 22, which this package already requires viaengines)dir-compare→ customcompareDirectories()implementation (~30 LOC recursive walker with content comparison)Dependencies Kept
@electron/asar— essential, no builtin equivalentdebug— widely used logging withDEBUGenv var supportplist— Apple plist XML parsing/serializationNotes
minimatchusages used{ matchBase: true }. The replacement checks whether the pattern contains/to decide between matching the full path or just the basename viapath.matchesGlob().compareDirectories()function is a minimal replacement that covers the exact usage pattern: recursive file content comparison returning a diffSet withstate,name1, andrelativePath.@types/minimatchfrom devDependencies.https://claude.ai/code/session_0112RFfDPLMXemxFs6qcKf27