Skip to content

Instantly share code, notes, and snippets.

@benmccallum
Last active May 10, 2018 01:53
Show Gist options
  • Select an option

  • Save benmccallum/61930dcef5c82abec2f1e554c36b8aaa to your computer and use it in GitHub Desktop.

Select an option

Save benmccallum/61930dcef5c82abec2f1e554c36b8aaa to your computer and use it in GitHub Desktop.
Param(
[string]$windowsUser,
[string]$sourceRootPath
)
yarn global add undefender
undefender "C:\Program Files\nodejs"
if (![string]::IsNullOrWhiteSpace(($windowsUser))) {
undefender "C:\Users\$windowsUser\.dotnet\NuGetFallbackFolder"
undefender "C:\Users\$windowsUser\.nuget\packages"
undefender "C:\Users\$windowsUser\AppData\Local\Yarn"
undefender "C:\Users\$windowsUser\AppData\Roaming\npm"
undefender "C:\Users\$windowsUser\AppData\Roaming\npm-cache"
}
if (![string]::IsNullOrWhiteSpace(($sourceRootPath))) {
((Get-ChildItem -Path $sourceRootPath -Directory -Filter "*node_modules*" -Recurse).FullName | Where-Object { -not $_.Contains("\node_modules\") }) | ForEach-Object { undefender $_ }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment