stevegrunwell / asimov

Automatically exclude development dependencies from Apple Time Machine backups
MIT License
1.62k stars 92 forks source link

Block package managers' cache directories #58

Open stevegrunwell opened 4 years ago

stevegrunwell commented 4 years ago

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?

muuvmuuv commented 4 years ago

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

stevegrunwell commented 4 years ago

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?

muuvmuuv commented 4 years ago

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.

TheNoim commented 4 years ago

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.

Clashsoft commented 4 years ago

Some additions:

Tool Cache Directory
pnpm ~/.pnpm-store
Gradle ~/.gradle/caches, ~/.gradle/wrapper
tomtastic commented 3 years ago

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