Skip to content

Instantly share code, notes, and snippets.

@sciolist
Created May 23, 2018 14:02
Show Gist options
  • Save sciolist/3502119592e652a67b23102713e1e136 to your computer and use it in GitHub Desktop.
Save sciolist/3502119592e652a67b23102713e1e136 to your computer and use it in GitHub Desktop.
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