Skip to content

build: replace unmaintained temp dependency with fs.mkdtemp#607

Merged
erikian merged 1 commit into
mainfrom
replace-temp-dep
Jul 1, 2026
Merged

build: replace unmaintained temp dependency with fs.mkdtemp#607
erikian merged 1 commit into
mainfrom
replace-temp-dep

Conversation

@claude

@claude claude Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Requested by Samuel Attard · Slack thread

Closes #581

Before / After

Before: The package pulled in the unmaintained temp npm module (plus its @types/temp typings) solely to create a tracked temporary directory. src/temp-utils.ts called temp.track() and exposed a promisified temp.mkdir as createTempDir.

After: The package uses Node's built-in fs.mkdtemp (via the already-present fs-extra) with os.tmpdir(). No third-party dependency is required, and temp / @types/temp are removed from package.json and the yarn lockfile.

How

src/temp-utils.ts now implements createTempDir(prefix) by calling fs.mkdtemp(path.join(os.tmpdir(), prefix)). The exported function signature is unchanged ((prefix: string) => Promise<string>), so all callers (src/index.ts and 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 single process.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 two installer-spec tests and sign-spec fail 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

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
@claude claude Bot changed the title Replace unmaintained temp dependency with Node's fs.mkdtemp build: replace unmaintained temp dependency with fs.mkdtemp Jul 1, 2026
@MarshallOfSound MarshallOfSound marked this pull request as ready for review July 1, 2026 05:45
@MarshallOfSound MarshallOfSound requested a review from a team as a code owner July 1, 2026 05:45
@erikian erikian merged commit 93ca6a4 into main Jul 1, 2026
14 of 15 checks passed
@erikian erikian deleted the replace-temp-dep branch July 1, 2026 11:33
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.

Stop using temp and replace it with tempy

3 participants