Skip to content

chore(cli): replace tmp with crypto.randomUUID - #2284

Merged
netomi merged 1 commit into
eclipse-openvsx:mainfrom
trivikr:remove-tmp
Oct 3, 2026
Merged

netomi merged 1 commit into
eclipse-openvsx:mainfrom
trivikr:remove-tmp

Conversation

@trivikr

@trivikr trivikr commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Removes tmp (and @types/tmp) as a direct dependency of ovsx.

createTempFile only ever used tmp.tmpName, which returns an unused
path in the OS temp directory without creating anything. The same is
now produced with path.join(os.tmpdir(), \ovsx-${crypto.randomUUID()}${postfix}`)`.

createTempFile only needs an unused path in the OS temp directory,
which path.join(os.tmpdir(), randomUUID()) provides without a
dependency. The { postfix } option and async signature are kept, so
callers are unchanged.

Signed-off-by: Trivikram Kamat <[email protected]>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The replacement preserves existing caller behavior, supports the required Node.js version, and includes focused tests.

Review effort: Balanced
Findings: None

What changed in this PR

Replaces the CLI’s direct tmp dependency with Node.js UUID-based temporary paths.

Changes:

  • Generates temporary paths using crypto.randomUUID.
  • Removes direct tmp dependencies and updates the lockfile.
  • Adds unit coverage and a changelog entry.
File Description
cli/​src/​util.ts Implements UUID-based temporary paths.
cli/​test/​unit/​util.spec.ts Tests path location, postfix, and uniqueness.
cli/​package.json Removes direct tmp dependencies.
cli/​yarn.lock Updates resolved direct dependencies.
cli/​CHANGELOG.md Documents the dependency change.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@netomi

netomi commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

LGTM, ty

@netomi

netomi commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

We should actually also add automatic cleanup for temporary files, but that should be done via a separate PR.
Also the name of the function to generate a temp file is misleading, as it does not generate the file yet.

@netomi
netomi merged commit 13b1b01 into eclipse-openvsx:main Oct 3, 2026
5 checks passed
@trivikr
trivikr deleted the remove-tmp branch October 3, 2026 20:16
@trivikr

trivikr commented Oct 3, 2026

Copy link
Copy Markdown
Contributor Author

We should actually also add automatic cleanup for temporary files

The cleanup is done in verify and registry. It was missing in publish, so I posted a PR at #2286

Also the name of the function to generate a temp file is misleading

Proposed renaming it to getTempFilePath in #2285

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.

3 participants