Repository navigation
npkill started in 2019 as a small script to hunt node_modules. Six years later, node_modules is only part of what piles up on a dev machine. Every framework and language leaves its own build outputs and caches behind.
If you don't want to change anything, you don't have to. npx npkill works as always, it just finds a lot more.
You can read all the details of this update in this post or watch the teaser (1:15).
Added
- Added profiles: sets of targets that represent a development ecosystem. The default one is
node, which findsnode_modulesand also.next,.nuxt,.angular,.turboand friends. There are 20 built-in profiles (python,rust,java,dotnet,unity...). Use them with--profiles node,pythonor list them with--profiles. More info. - Added smart targets: some folders are only shown when the files around them confirm what they are. For example,
targetonly appears next to aCargo.tomlorpom.xml. - Added
.npkillrc: define your default options and your own profiles. npkill looks for./.npkillrcfirst and then for~/.npkillrc. You can also use--config. More info. - Added panels: navigate with
←and→betweenHelp,Options, the results andInfo.- Help: quick reference with all the shortcuts.
- Options: change the sort, the targets or the directory without restarting npkill.
- Info: details of the result under the cursor, like the exact date of the last change or the risk of deleting it.
- Added multi-select mode: press
tto select several results and delete them at once. Usevto select a range andato select all. - Added search: press
/to filter the results by name or path. It supports regex. - Added JSON output:
--jsonprints all the results as a single object and--json-streamprints one result per line as they are found. Both can delete without the interface with--delete-all -y. More info. - Added API: the core is now separated from the cli, so you can use npkill from your own code with
import { Npkill } from 'npkill'. More info. - Added multiple targets:
--targets node_modules,.cache. - Added
--older-than: only show results whose project has not been modified in the given number of days (#271, thanks @Shreyakb301). - Added
--no-size,--no-ageand--no-statsto skip the calculations you don't need (#246, #250, thanks @yetanotheraryan and @StanislavKozachenko). - Added
--size-unit(auto,mb,gb). Withautothe unit changes between MB and GB by itself. - Added
--no-ignore-defaultto also look inside the folders that npkill skips by default, like.gitor.nvm. - Added scrollbar to the results. Yes, it didn't have one. I'd rather not talk about it.
- Added results counter and the active profiles in the header.
Changed
- ❗ Changed
--targetto--targets. - ❗ Changed
--exclude-hidden-directoriesto--exclude-sensitive.-xno longer hides the "dot" directories, it hides the results marked as sensitive. - ❗ Changed
--delete-all: now it requires--targets. Nothing is deleted automatically unless you say exactly what. - ❗ Changed
--sort last-modto--sort age. TheLast_modcolumn is nowAge. - ❗ Changed
-gbto--size-unit gb. - ❗ Removed
--bg-color. - ❗ Unknown options are now rejected instead of ignored.
- Changed
--exclude: now it accepts patterns. A name matches anywhere,./pathmatches from the scan root and**/pathmatches at any depth (#269, thanks @Ludvins and @NyaGarcia). - Changed search engine: workers now share memory. Up to 3x faster searches (#281).
- Changed size calculation: it now runs in the workers and no longer follows symlinks.
- Symlinks are now skipped during the search.
- Improved the detection of sensitive results.
- Improved
--helpoutput. - Improved the "no results" message and the
SizeandAgeloading indicators. - Simplified the header. Columns now adapt to the terminal width.
- Replaced
colorswithpicocolorsand removed unused dependencies. - Update dependencies.
Fixed
- Fixed npkill not starting in non-TTY environments.
- Fixed results flickering when two of them have the same value on sort.
- Fixed stats going back to their default value when resizing or changing panel.
- Fixed npkill not working on Android (#275, thanks @kukirin-ui).
- Fixed the search hanging when the scan fails. Now it exits with the reason.
- Fixed typo in the exit text (#189, thanks @zaaakher).
Thanks to everyone who reported bugs and shared ideas during all these years. npkill wouldn't be what it is without you.
npx npkill@latest and share your results!