nuke-mods v1.1.0
Nuke-mods 🚀
nuke-mods is a command-line tool to delete all node_modules directories in a specified folder and its subdirectories, with the option to exclude specific folders from deletion. 💻🗑️
No more manual deletion and don't let node_modules eat up your storage!
Features ✨
- Delete all
node_modulesdirectories inside the specified folder and its subfolders. - Exclude specific folders (both top-level and nested) from deletion.
- Process multiple folders at once.
- Defaults to the current directory if no folder is specified.
Installation ⚙️
Install nuke-mods globally with npm:
npm install -g nuke-modsUsage 📜
Basic Usage
By default, nuke-mods will delete all node_modules directories inside the current directory:
nuke-modsSpecify Folders to Search
Specify one or more folders to search for node_modules directories:
nuke-mods folder1,folder2Exclude Specific Folders
Use the --exclude flag to exclude one or more folders (and their node_modules) from deletion. The script will skip deleting node_modules inside these excluded folders:
nuke-mods --exclude=folder3,folder4You can specify multiple folders to exclude, and they can be nested. The script will only skip node_modules inside the specified folders.
Combine Folders and Exclusions
You can combine both folder specifications and exclusions:
nuke-mods folder1,folder2 --exclude=folder3,folder4This will:
- Search for
node_modulesinsidefolder1andfolder2. - Exclude any
node_modulesinsidefolder3andfolder4(including nested ones).
Examples
Delete
node_modulesinside the current directory:nuke-modsDelete
node_modulesinsideproject-1andproject-2, but excludenode_modulesinsideproject-2/pro-4:nuke-mods project-1,project-2 --exclude=project-2/pro-4Delete
node_modulesinsideproject-1,project-2, andproject-3, but excludeproject-2/pro-4andproject-1/pro-1:nuke-mods project-1,project-2,project-3 --exclude=project-2/pro-4,project-1/pro-1
How It Works 🛠️
- Target Folders: The script looks for
node_modulesinside the folders you specify or the current directory by default. - Exclusion Logic: If you specify
--exclude, the script will skip deletingnode_modulesinside those excluded folders, whether they are top-level or nested.
Installation Issues 🚨
If you run into issues with the command not being recognized, ensure the package is installed globally:
npm install -g nuke-modsYou may also need to ensure the script has executable permissions:
chmod +x /path/to/nuke-modsAccidently deleted node_modules?? No worries just run:
npm install