Skip to content

Wait, what? You really don't need those 30k+ files for a simple react project?

License

Notifications You must be signed in to change notification settings

denisbrodbeck/purge-npm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

purge-npm finds all your node_modules folders and burns them with fire

GoDoc Go Report Card

Tested on: Linux, OS X, Windows

Why

Well, why not? Who needs 28.000 files in a pristine create-react-app, anyways?

I work on the web, I try new stuff, I abandon failed projects and I always forget to clean up my node_modules directories after switching projects. And I always forget the correct syntax for find/bash/powershell.

What

  • tiny command line app written in go
  • expects a root directory - defaults to current directory
  • searches below the root directory all directories named node_modules using a breadth first approach
  • and deletes those suckerz

How

go get github.com/denisbrodbeck/purge-npm

purge-npm ~/code/
  /home/luke/code/react-app/node_modules
  /home/luke/code/vuejs-app/node_modules
  /home/luke/code/gatsby-site/node_modules
  /home/luke/code/corp/web/blub/node_modules
  ...
  # ~1.500.000 deleted files later 7GB disc space is freed

All available flags:

purge-npm [--dry] [<path>]
Flags:
  --dry  <bool>     output found directories only - do not remove

All exit codes:

0: success (each removed folder is printed to stdout)
1: execution error (see stderr)
2: cli usage error (see stderr)

Possible failures:

  • stack-overflow because of the recursive directory walking function - but then you've already got waaay bigger problems than this tool failing
  • file permissions
  • invalid cli usage (impossible path, etc.)

License

The MIT License (MIT) — Denis Brodbeck. Please have a look at the LICENSE for more details.

About

Wait, what? You really don't need those 30k+ files for a simple react project?

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages