Skip to content

Commit

Permalink
feat(core): make it possible to use environment variable to set cache…
Browse files Browse the repository at this point in the history
… directory

Use the environment variable NX_CACHE_DIRECTORY to set the cache directory.
This would override the cache directory set in nx.json.

ISSUES CLOSED: #6629
  • Loading branch information
shihabuddin committed Aug 10, 2021
1 parent 549b735 commit 6c16ee0
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/workspace/src/utilities/cache-directory.ts
Expand Up @@ -2,6 +2,10 @@ import { join } from 'path';
import { readJsonFile } from './fileutils';

export function readCacheDirectoryProperty(root: string) {
const cacheDir = process.env.NX_CACHE_DIRECTORY;
if (cacheDir) {
return cacheDir;
}
try {
const nxJson = readJsonFile(join(root, 'nx.json'));
return nxJson.tasksRunnerOptions.default.options.cacheDirectory;
Expand Down

0 comments on commit 6c16ee0

Please sign in to comment.