chore: refine yarn cache config#11782
Conversation
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 7173491:
|
|
Build successful! You can test your changes in the REPL here: https://babeljs.io/repl/build/25179/ |
7b6c023 to
6b4d26c
Compare
| - &restore-yarn-cache | ||
| keys: | ||
| - v1-yarn-cache | ||
| - v1-1-yarn-cache-{{ checksum "yarn.lock" }} |
There was a problem hiding this comment.
The v2- has been used as prefix in Babel 8. So we resort to v1-1.
| - &restore-node-modules-cache | ||
| keys: | ||
| - v1-yarn-deps-{{ checksum "yarn.lock" }} | ||
| - v1-yarn-deps- |
There was a problem hiding this comment.
Why do we need this key without the hash?
There was a problem hiding this comment.
Good question!
It is intended to fetch the latest cache generated successfully by any branch if the yarn.lock is changed. Chances are that there could be some cache contents that can still be reused by yarn, i.e. some libraries that are still resolved by the changed lock file.
See also https://circleci.com/docs/2.0/caching/#restoring-cache
The Yarn Cache is not working properly because the cache directory of Yarn 1 is not
~/.yarn-cache, as we can see from this job log, the cache is only 32B.Ideally we should run
yarn cache dirand use this value as the paths that we should cache. However Circle-CI does not support template on cache paths.Here is comparison of
yarn installtime between this PR andmain.