Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(core): use node_modules/.cache/nx as default for projectGraphCac… #13470

Conversation

jonhamm
Copy link
Contributor

@jonhamm jonhamm commented Nov 29, 2022

Current Behavior

When changing the location of the nx cache directory away from default node_modules/.cache/nx

  • using .cacheDirectory option in nx.json or NX_CACHE_DIRECTORY environment variable -
    the location of projectGraphCacheDirectory follows the nx cache directory
    unless environment NX_PROJECT_GRAPH_CACHE_DIRECTORY is set.

Expected Behavior

The location of projectGraphCacheDirectory should stay in node_modules/.cache/nx
unless environment NX_PROJECT_GRAPH_CACHE_DIRECTORY is set.
The rationale is that changing the normal cache directory to some directory shared by
multiple worktrees/repos will result in error if the projectGraphCacheDirectory is also shared.

BREAKING CHANGE:

The default of projectGraphCacheDirectory no longer follows the location of cacheDirectory

Related Issue(s)

This is one of two Pull Requests fixing the same problem
This one does the minimal changes
Only one of the PRs should be merged
Closes #13471

Fixes #

…heDirectory

The default value for projectGraphCacheDirectory is
changed to `node_modules/.cache/nx`.
The
rationale for this is that if someone moves the
nx cache of artefacts by setting
`NX_CACHE_DIRECTORY`
or setting `cacheDirectory` in `nx.json` to some location
that will be shared
among multiple worktrees/repos then
it is undesirable to have daemon and project graph cache
shared
too.
This is a BREAKING change as projectGraphCacheDirectory
would previously move with the achanges
to `cacheDirectory`
and/or `NX_CACHE_DIRECTORY`.
It is however not a breaking change that is
expected to
affect anyone negatively and in the unlikely case we have
environment
NX_PROJECTNX_PROJECT_GRAPH_CACHE_DIRECTORY

BREAKING CHANGE:
The default of projectGraphCacheDirectory no longer follows the location of cacheDirectory
@vercel
Copy link

vercel bot commented Nov 29, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
nx-dev ✅ Ready (Inspect) Visit Preview Nov 29, 2022 at 1:35PM (UTC)

@FrozenPandaz
Copy link
Collaborator

Thank you for your contribution! This looks great. 🎉

@FrozenPandaz FrozenPandaz merged commit 19acffa into nrwl:master Nov 29, 2022
@jonhamm jonhamm deleted the default-projectGraphCacheDirectory-to-workspace-local-cache branch March 7, 2023 08:52
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants