build: replace unmaintained temp dependency with fs.mkdtemp#607
Merged
Conversation
Use Node's built-in fs.mkdtemp (via fs-extra) with os.tmpdir() to create temporary directories, removing the unmaintained `temp` npm module and its `@types/temp` typings. Cleanup semantics from `temp.track()` are preserved by tracking created directories and removing them on process exit. Closes #581 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014t5CkSh3wMXJRmF6YxEGbh
temp dependency with Node's fs.mkdtemptemp dependency with fs.mkdtemp
MarshallOfSound
approved these changes
Jul 1, 2026
erikian
approved these changes
Jul 1, 2026
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.
Requested by Samuel Attard · Slack thread
Closes #581
Before / After
Before: The package pulled in the unmaintained
tempnpm module (plus its@types/temptypings) solely to create a tracked temporary directory.src/temp-utils.tscalledtemp.track()and exposed a promisifiedtemp.mkdirascreateTempDir.After: The package uses Node's built-in
fs.mkdtemp(via the already-presentfs-extra) withos.tmpdir(). No third-party dependency is required, andtemp/@types/tempare removed frompackage.jsonand the yarn lockfile.How
src/temp-utils.tsnow implementscreateTempDir(prefix)by callingfs.mkdtemp(path.join(os.tmpdir(), prefix)). The exported function signature is unchanged ((prefix: string) => Promise<string>), so all callers (src/index.tsand the specs/helpers) work without modification.Cleanup semantics are preserved.
temp.track()automatically removed created temp directories when the process exited. To match that behavior, the module keeps an array of the directories it creates and registers a singleprocess.on('exit', ...)handler that removes each of them synchronously (best-effort, errors ignored). This mirrors the prior auto-cleanup-on-exit behavior that the test suite relied on, so no manual cleanup was needed in callers.Test / build status
yarn build(tsc): passes.yarn lint(eslint): passes.yarn ava: unit tests pass. The twoinstaller-spectests andsign-specfail in this environment because they require Windows (or Mono + Wine) to run Squirrel/signing — these failures occur before any temp-dir logic and are unrelated to this change. The temp-directory helpers (createTempAppDirectory,createTempDir) are exercised by the passing/attempted tests without error.Generated by Claude Code