Last active
August 29, 2015 14:24
-
-
Save DamianMullins/428b9f8b7bfee7e05730 to your computer and use it in GitHub Desktop.
Uninstall npm packages by scanning directories inside node_modules
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Uninstall-NpmPackagesInDirectory { | |
Param ( | |
# Optional path to node_modules directory | |
[String]$pathToNodeModules = (Get-Item -Path ".\node_modules").FullName | |
) | |
# Loop over each folder in the directory | |
ForEach ($dep in Get-ChildItem -Path $pathToNodeModules | ? { $_.FullName -notmatch ".bin" }) { | |
# Uninstall the package | |
iex "npm uninstall $dep" | |
#iex "echo $dep" | |
} | |
} | |
#Uninstall-NpmPackagesInDirectory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment