asimov icon indicating copy to clipboard operation
asimov copied to clipboard

Block package managers' cache directories

Open stevegrunwell opened this issue 4 years ago • 6 comments

Package managers will typically create a cache directory in order to prevent the same packages from being downloaded over and over again. For example, Composer will store these in ~/.composer/cache.

Since these too are development dependencies that can easily be restored, they should be omitted from Time Machine backups.

Tool Cache Directory
Bundler ~/.bundle/cache
Composer ~/.composer/cache
npm ~/.npm/_cacache
nvm ~/.nvm/versions
Yarn ~/.yarn-cache

It's worth noting that these are often configurable, so if the given tools are available we may want to try to query their configurations.

What other cache directories are hiding out in our home directories?

stevegrunwell avatar Jun 18 '20 21:06 stevegrunwell

Would it be worth also ignoring .cache in projects? Some tools like GatsbyJS use them.

muuvmuuv avatar Jun 19 '20 07:06 muuvmuuv

I'd say we should absolutely ignore those, but I'm wary of ignoring all .cache directories, since someone could have a .cache directory that has nothing to do with Gatsby.

Is there a dependency file that we might be able to look for to ensure we're only blocking caches that can be re-created?

stevegrunwell avatar Jun 19 '20 14:06 stevegrunwell

Using gatsby requires a gatsby-config.js in the project root or at least it is needed to setup gatsby properly, never tried or read that it is not needed: https://www.gatsbyjs.org/docs/api-files-gatsby-config/

Gatsby also generates static files in public so those can be ignored as well, just in case of gatsby.

muuvmuuv avatar Jun 20 '20 17:06 muuvmuuv

but I'm wary of ignoring all .cache directories, since someone could have a .cache directory that has nothing to do with Gatsby.

But why do you need any kind of cache in your time machine? I would suggest excluding all cache like directories.

TheNoim avatar Jul 11 '20 23:07 TheNoim

Some additions:

Tool Cache Directory
pnpm ~/.pnpm-store
Gradle ~/.gradle/caches, ~/.gradle/wrapper

Clashsoft avatar Aug 23 '20 18:08 Clashsoft

What about Go paths also, which seems to have caused at least one Timemachine restore problem : https://twitter.com/thisdougb/status/1378390726950617091?s=20

tomtastic avatar Apr 04 '21 06:04 tomtastic