refactor: replace temp package with Node built-in fs.mkdtemp#599
Open
thedavidweng wants to merge 1 commit into
Open
refactor: replace temp package with Node built-in fs.mkdtemp#599thedavidweng wants to merge 1 commit into
thedavidweng wants to merge 1 commit into
Conversation
The temp package (v0.9.4, last released November 2020) depends on rimraf@~2.6.2 -> glob@7.2.3 -> inflight@1.0.6, all of which are deprecated. inflight is also flagged for memory leaks (CWE-772). The only usage of temp in this project is creating a single temporary directory via createTempDir, which maps directly to Node's built-in fs.mkdtemp combined with os.tmpdir. This removes the temp and @types/temp dependencies entirely, eliminating the deprecated transitive dependency chain. fs.mkdtemp has been stable since Node 5.10.0 and util.promisify since Node 8.0.0, both within the existing engine requirement of >=8.0.0. The exported createTempDir function signature and return type are unchanged.
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.
What
Replace the
temppackage with Node's built-infs.mkdtemp+os.tmpdir.Why
The
temppackage (v0.9.4) was last released in November 2020 and is effectively unmaintained. It pins deprecated transitive dependencies:All four packages are deprecated.
inflightis also flagged for memory leaks (CWE-772).The only usage of
tempin this project is creating a single temporary directory viacreateTempDir('si-')insrc/index.ts:161, which maps directly to Node's built-infs.mkdtemp.Changes
src/temp-utils.ts: Replacetemp.mkdirwithfs.mkdtemp+os.tmpdir+path.joinpackage.json: Removetempfrom dependencies and@types/tempfrom devDependenciesCompatibility
fs.mkdtemphas been stable since Node 5.10.0util.promisifyhas been stable since Node 8.0.0>=8.0.0createTempDirfunction signature and return type are unchangedNotes
This is a revival of #584 (closed by the original author). The approach is identical — the only difference is using
path.join(tmpdir(), prefix)for clarity.Closes #581