npkill icon indicating copy to clipboard operation
npkill copied to clipboard

allow deletion without using TUI

Open michaelchadwick opened this issue 1 year ago • 7 comments

Problem It would be nice to be able to use npkill without using the TUI as it is a potential extra step/click/key and a slight(:-P) performance impediment.

Solution Add a command line argument that skips the UI, runs npkill deletion service, and displays results on command line.

Alternative The best set of arguments I have found thus far is npx npkill -D -x -y -nu which deletes node_modules, skips hidden stuff, auto-confirms, doesn't check for updates, but still requires an exit of the TUI.

michaelchadwick avatar Jul 16 '24 16:07 michaelchadwick

Great suggestion, I need this too, especially in the CI process, where it is necessary to automatically execute the subsequent scripts.

mfer725 avatar Jul 21 '24 08:07 mfer725

I have a similar requirement, to have a proper non-interactive mode so i can call this as a CI script. The -D option suggests non-interactive but we also define the -y option. This is described as "Avoid displaying a warning when executing --delete-all" rather than acting as a non-interactive input mode.

A simple test is to pipe npkill through cat (npkill | cat) which confirms the command needs a TTY: "Oh no! Npkill does not support this terminal (TTY is required). This is a bug, which has to be fixed. Please try another command interpreter (for example, CMD in windows)".

It would be great to remove this condition and fix the bug as mentioned, (with -D and/or -y) to run non interactively. Thanks!

craigryan avatar Jan 07 '25 00:01 craigryan

Hey @zaldih, first off, thanks a lot for this incredibly useful package! I find myself using it all the time.

I'm currently in need of this feature (allow deleting node_modules without the UI) I was wondering if you'd be open to accepting a PR for this implementation?

I noticed there hasn't been much recent interaction in the issues tab, so I wanted to ask before diving in.

khaledtb avatar Mar 30 '25 00:03 khaledtb

Hi everyone! Sorry for the delay.

Some time ago I started working on this but due to lack of time I had to pause it.

I'm working on this: #205 , which will allow to deal with this by allowing to run npkill without ui, directly from a script.

I know the main issue is to run it directly without ui and without having to create custom node scripts, but with the changes I'm making that should be coming soon in the following weeks :)

zaldih avatar Jul 26 '25 15:07 zaldih

@khaledtb If you are still interested, as soon as I finish the work on the api refactor, you could of course get your hands on it to fix the TTY problem that @craigryan mentions.

zaldih avatar Jul 26 '25 15:07 zaldih

when is this being shipped?

smashah avatar Oct 07 '25 16:10 smashah