Skip to content

Instantly share code, notes, and snippets.

@cwonrails
Forked from themanifold/node-prune.sh
Last active December 15, 2017 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwonrails/c1f43407c30de9e64c9c803555625191 to your computer and use it in GitHub Desktop.
Save cwonrails/c1f43407c30de9e64c9c803555625191 to your computer and use it in GitHub Desktop.
Pruning useless node_modules with bash userland tools (find etc)
#!/usr/bin/env bash
find node_modules \( -name '__tests__' -o \
-name 'tests' -o \
-name 'powered-test' -o \
-name 'docs' -o \
-name 'doc' -o \
-name '.idea' -o \
-name '.vscode' -o \
-name 'website' -o \
-name 'images' -o \
-name 'assets' -o \
-name 'example' -o \
-name 'examples' -o \
-name 'coverage' -o \
-name '.nyc_output' -o \
-name 'Makefile' -o \
-name '*ulpfile.js' -o \
-name '*runtfile.js' -o \
-name 'appveyor.yml' -o \
-name 'circle.yml' -o \
-name 'codeship*.yml' -o \
-name 'wercker.yml' -o \
-name '.tern-project' -o \
-name '.gitattributes' -o \
-name '.editorconfig' -o \
-name '.*ignore' -o \
-name '.eslintrc' -o \
-name '.eslintrc.*' -o \
-name '.jshintrc' -o \
-name '.flowconfig' -o \
-name '.documentup.json' -o \
-name '.yarn-metadata.json' -o \
-name '.travis.yml' -o \) -exec rm -rf {} \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment