Automatically clear development and browser caches (for local dev and browsers).
npm install cache-cleaner.next, .vite, dist, build, and node_modules/.cache.
npx cache-cleaner with options for dry-run and custom folders.
js
import { clearCache } from 'cache-cleaner';
await clearCache(['dist', 'node_modules/.cache']);
`
Browser:
`js
import { clearBrowserCache } from 'cache-cleaner';
clearBrowserCache({
clearLocalStorage: true,
clearSessionStorage: true,
clearIndexedDB: true,
unregisterServiceWorkers: true,
hardReload: true
});
`
CLI:
`
npx cache-cleaner
`
Testing
Run unit tests with:
`
npm install
npm test
``