Skip to content

refactor: replace external dependencies with Node.js built-ins#189

Open
MarshallOfSound wants to merge 4 commits intomainfrom
claude/minimize-dependencies-4iTn0
Open

refactor: replace external dependencies with Node.js built-ins#189
MarshallOfSound wants to merge 4 commits intomainfrom
claude/minimize-dependencies-4iTn0

Conversation

@MarshallOfSound
Copy link
Copy Markdown
Member

@MarshallOfSound MarshallOfSound commented Apr 4, 2026

This PR removes 3 production dependencies by replacing them with Node.js built-in equivalents, reducing the transitive dependency footprint.

Summary

  • @malept/cross-spawn-promisepromisify(execFile) from node:child_process. Also replaced spawn('mv', ...) with the existing fsMove() utility.
  • minimatchpath.matchesGlob() (stable in Node.js 22, which this package already requires via engines)
  • dir-compare → custom compareDirectories() implementation (~30 LOC recursive walker with content comparison)

Dependencies Kept

  • @electron/asar — essential, no builtin equivalent
  • debug — widely used logging with DEBUG env var support
  • plist — Apple plist XML parsing/serialization

Notes

  • All minimatch usages used { matchBase: true }. The replacement checks whether the pattern contains / to decide between matching the full path or just the basename via path.matchesGlob().
  • The compareDirectories() function is a minimal replacement that covers the exact usage pattern: recursive file content comparison returning a diffSet with state, name1, and relativePath.
  • Removed @types/minimatch from devDependencies.

https://claude.ai/code/session_0112RFfDPLMXemxFs6qcKf27

claude added 2 commits April 4, 2026 05:25
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
@MarshallOfSound MarshallOfSound requested a review from a team as a code owner April 4, 2026 05:31
@MarshallOfSound MarshallOfSound changed the title Remove external dependencies, use Node.js built-ins refactor: remove external dependencies, use Node.js built-ins Apr 4, 2026
@MarshallOfSound MarshallOfSound changed the title refactor: remove external dependencies, use Node.js built-ins refactor: replace external dependencies with Node.js built-ins Apr 4, 2026
@socket-security
Copy link
Copy Markdown

socket-security bot commented Apr 4, 2026

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Updated@​types/​plist@​3.0.4 ⏵ 3.0.51001007380100
Updated@​types/​debug@​4.1.10 ⏵ 4.1.131001008885100

View full report

claude added 2 commits April 4, 2026 05:37
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
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