-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): use current user when hashing native file & enable setting…
- Loading branch information
1 parent
4f7bf97
commit 7a9bb68
Showing
4 changed files
with
18 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,17 @@ | ||
import { tmpdir } from 'os'; | ||
import { tmpdir, userInfo } from 'os'; | ||
import { join } from 'path'; | ||
import { createHash } from 'crypto'; | ||
import { workspaceRoot } from '../utils/workspace-root'; | ||
|
||
export const nativeFileCacheLocation = join( | ||
tmpdir(), | ||
'nx-native-file-cache', | ||
createHash('sha256').update(workspaceRoot).digest('hex') | ||
); | ||
export function getNativeFileCacheLocation() { | ||
if (process.env.NX_NATIVE_FILE_CACHE_DIRECTORY) { | ||
return process.env.NX_NATIVE_FILE_CACHE_DIRECTORY; | ||
} else { | ||
const shortHash = createHash('sha256') | ||
.update(userInfo().username) | ||
.update(workspaceRoot) | ||
.digest('hex') | ||
.substring(0, 7); | ||
return join(tmpdir(), `nx-native-file-cache-${shortHash}`); | ||
} | ||
} |