welcoMattic / kymsu

Keep Your macOs Stuff Updated (KYMSU)
https://welcomattic.github.io/kymsu
MIT License
129 stars 31 forks source link

Clean npm cache only if npm version less than 5.0.0 #40

Closed hdushan closed 5 years ago

hdushan commented 5 years ago

With newer versions of npm, npm cache clean results in this error: As of npm@5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use 'npm cache verify' instead. On the other hand, if you're debugging an issue with the installer, you can usenpm install --cache /tmp/empty-cacheto use a temporary cache instead of nuking the actual one

From npm 5.0.0 release notes (https://github.com/npm/npm/releases/tag/v5.0.0):

A new npm cache verify command that will garbage collect your cache, reducing disk usage for things you don't need (-handwave-), and will do full integrity verification on both the index and the content. This is also hooked into npm doctor as part of its larger suite of checking tools.

The new cache is very fault tolerant and supports concurrent access.

Multiple npm processes will not corrupt a shared cache. Corrupted data will not be installed. Data is checked on both insertion and extraction, and treated as if it were missing if found to be corrupted. I will literally bake you a cookie if you manage to corrupt the cache in such a way that you end up with the wrong data in your installation (installer bugs notwithstanding). npm cache clear is no longer useful for anything except clearing up disk space.

welcoMattic commented 5 years ago

Hi ! Thanks a lot for your contribution 😉 I will merge it as soon as emojis will be replaced

hdushan commented 5 years ago

Have updated the emojis

welcoMattic commented 5 years ago

Thank you @hdushan!