Created
May 23, 2018 14:02
-
-
Save sciolist/3502119592e652a67b23102713e1e136 to your computer and use it in GitHub Desktop.
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
Param( | |
[string]$sourceRootPath | |
) | |
$paths=New-Object System.Collections.Generic.List[System.Object] | |
$paths.Add("C:\Program Files\nodejs") | |
$paths.Add("${HOME}\.dotnet\NuGetFallbackFolder") | |
$paths.Add("${HOME}\.nuget\packages") | |
$paths.Add("${HOME}\AppData\Local\Yarn") | |
$paths.Add("${HOME}\AppData\Roaming\npm") | |
$paths.Add("${HOME}\AppData\Roaming\npm-cache") | |
if (![string]::IsNullOrWhiteSpace(($sourceRootPath))) { | |
$queue = New-Object System.Collections.Generic.Queue[System.Object] | |
$queue.Enqueue((Get-Item $sourceRootPath)) | |
while ($queue.Count -gt 0) { | |
$folder=$queue.Dequeue(); | |
if ($folder.Name -eq "node_modules") { | |
$paths.Add($folder.FullName) | |
} else { | |
Get-ChildItem -Path $folder.FullName -Directory | ForEach-Object { $queue.Enqueue($_) } | |
} | |
} | |
} | |
undefender $paths |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment