Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/utils/ncc-cache-dir.js
Original file line number Diff line number Diff line change
@@ -1 +1,8 @@
module.exports = require("os").tmpdir() + "/ncc-cache";
const crypto = require("crypto");
const os = require("os");
const path = require("path");

const cacheBase = process.env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache");
const projectKey = crypto.createHash("sha256").update(process.cwd()).digest("hex").slice(0, 12);
Copy link
Copy Markdown
Member

@styfle styfle Apr 3, 2026

Choose a reason for hiding this comment

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

Suggested change
const projectKey = crypto.createHash("sha256").update(process.cwd()).digest("hex").slice(0, 12);
const projectKey = crypto.createHash("sha1").update(process.cwd()).digest("hex");

No reason to truncate. Just use a smaller hashing function if you don't need the entropy.


module.exports = path.join(cacheBase, "ncc", projectKey);
Loading