-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows ? #2
Comments
Contributions are welcome. |
Exactly! And you can use this code as a foundation (made by GPT-4, not tested): $TARGET_DIR = "node_modules"
if (-Not (Test-Path $TARGET_DIR)) {
Write-Host "$TARGET_DIR does not exist"
exit 1
}
$PATTERNS = @(
"__tests__", "_config.yml", ".*ignore", ".babel*", ".circle*", ".documentup*", ".ds_store", ".editorconfig",
".env*", ".git*", ".idea", ".lint*", ".npm*", ".nyc*", ".prettier*", ".tern-project", ".yarn-integrity",
".yarn-metadata.json", ".yarnclean", ".yo-*", "*.coffee", "*.flow*", "*.jst", "*.markdown", "*.md", "*.mkd", "*.swp",
"*.tgz", "*appveyor*", "*coveralls*", "*eslint*", "*htmllint*", "*jshint*", "*readme*", "*stylelint*", "*travis*",
"*tslint*", "*vscode*", "*wallaby*", "authors", "changelog", "changes", "circle.yml", "component.json", "contributors",
"coverage", "doc", "docs", "example", "examples", "grunt*", "gulp*", "jenkins*", "jest.config.*", "jsconfig.json",
"karma.conf*", "licence", "licence.txt", "license", "license.txt", "makefile", "npm-debug.log", "powered-test",
"prettier.*", "test", "tests", "tsconfig.json"
)
$PROD_PATTERNS = @(
"*.map", "*.mts", "*.ts"
)
if ($env:NODE_ENV -eq "production") {
$PATTERNS += $PROD_PATTERNS
}
if ($env:NODE_ENV -ne "production") {
Write-Host "$TARGET_DIR size before: $(Get-ChildItem $TARGET_DIR -Recurse | Measure-Object -Property Length -Sum | % { '{0:N2} MB' -f ($_.Sum / 1MB) })"
}
foreach ($pattern in $PATTERNS) {
Get-ChildItem $TARGET_DIR -Recurse -Include $pattern | Remove-Item -Recurse -Force
}
if ($env:NODE_ENV -ne "production") {
Write-Host "$TARGET_DIR size after: $(Get-ChildItem $TARGET_DIR -Recurse | Measure-Object -Property Length -Sum | % { '{0:N2} MB' -f ($_.Sum / 1MB) })"
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi,
Great to have a Windows version... Powershell.
Thanks.
The text was updated successfully, but these errors were encountered: