Skip to content

Replace temp package with Node.js built-in fs.mkdtemp#10967

Merged
NullVoxPopuli merged 2 commits intomasterfrom
copilot/replace-temp-package
Mar 24, 2026
Merged

Replace temp package with Node.js built-in fs.mkdtemp#10967
NullVoxPopuli merged 2 commits intomasterfrom
copilot/replace-temp-package

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 24, 2026

Remove the temp npm dependency by using Node.js built-in fs.mkdtemp / fs.mkdtempSync, which provide equivalent temporary directory creation without the extra package.

  • lib/tasks/install-blueprint.jstemp.mkdir('ember-cli')fs.mkdtemp(path.join(os.tmpdir(), 'ember-cli-')); removed now-unused util import
  • lib/commands/test.jstemp.mkdirSync('tests-dist-')fs.mkdtempSync(path.join(os.tmpdir(), 'tests-dist-'))
  • Test files — same pattern applied in insert-into-file-test.js and clean-remove-test.js
  • package.json — removed "temp": "0.9.4" from dependencies
// before
const temp = require('temp');
temp.track();
let dir = temp.mkdirSync('tests-dist-');

// after
const fs = require('fs');
const os = require('os');
const path = require('path');
let dir = fs.mkdtempSync(path.join(os.tmpdir(), 'tests-dist-'));
Original prompt

This section details on the original issue you should resolve

<issue_title>Consider replacing temp npm package</issue_title>
<issue_description>I have noticed that you are using temp npm package

I recently made a nanotemp npm package which is a drop-in replacement for temp package, it has ESM and CJS support and has a smaller install size

Comparison table

Details
[email protected] [email protected]
Package Size 17.7 kB 17 kB
Install Size 17.7 kB 209.2 kB
Direct Deps 0 2
Total Deps 0 14
Published Feb 27, 2026 Nov 10, 2020
Engines Node.js >=16.0.0 Node.js >=6.0.0
Types Included @types
Module Format ESM + CJS CJS

If this is something you would like to consider I can open a PR

</issue_description>

<agent_instructions>Use fs.mdtemp wherever the tmp package is used</agent_instructions>

Comments on the Issue (you are @copilot in this section)


⚡ Quickly spin up Copilot coding agent tasks from anywhere on your macOS or Windows machine with Raycast.

@NullVoxPopuli
Copy link
Copy Markdown
Contributor

@copilot no, I say fs.mkdtemp

…Sync`

- Replace `temp.mkdir()` with `fs.mkdtemp()` in lib/tasks/install-blueprint.js
- Replace `temp.mkdirSync()` with `fs.mkdtempSync()` in lib/commands/test.js
- Replace `temp.mkdirSync()` with `fs.mkdtempSync()` in test files
- Remove `temp` dependency from package.json

Co-authored-by: NullVoxPopuli <[email protected]>
Agent-Logs-Url: https://github.com/ember-cli/ember-cli/sessions/3b87bbe0-9fb7-4e6b-9c1f-184fdaa6ae23
Copilot AI changed the title [WIP] Replace temp npm package with nanotemp Replace temp package with Node.js built-in fs.mkdtemp Mar 24, 2026
Copilot AI requested a review from NullVoxPopuli March 24, 2026 12:17
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Mar 24, 2026

@copilot no, I say fs.mkdtemp

Already done — all usages are replaced with fs.mkdtemp / fs.mkdtempSync in commit 7bb343a.

@NullVoxPopuli NullVoxPopuli marked this pull request as ready for review March 24, 2026 12:39
@NullVoxPopuli NullVoxPopuli merged commit abe45fe into master Mar 24, 2026
71 checks passed
@NullVoxPopuli NullVoxPopuli deleted the copilot/replace-temp-package branch March 24, 2026 14:06
@mansona mansona mentioned this pull request Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Consider replacing temp npm package

4 participants