fix(core): include nx version in native file cache (#30963)

## Current Behavior
The native file cache doesn't check NX_VERSION when determining its key

## Expected Behavior
The native cache is invalidated when updating Nx

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #30940
Fixes #29184
This commit is contained in:
Craigory Coppola 2025-04-30 19:58:52 -04:00 committed by GitHub
parent fa92c4025e
commit cf81286421
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2,12 +2,13 @@ import { tmpdir, userInfo } from 'os';
import { join } from 'path';
import { createHash } from 'crypto';
import { workspaceRoot } from '../utils/workspace-root';
import { nxVersion } from '../utils/versions';
export function getNativeFileCacheLocation() {
if (process.env.NX_NATIVE_FILE_CACHE_DIRECTORY) {
return process.env.NX_NATIVE_FILE_CACHE_DIRECTORY;
} else {
const hash = createHash('sha256').update(workspaceRoot);
const hash = createHash('sha256').update(workspaceRoot).update(nxVersion);
try {
hash.update(userInfo().username);