Last 12 weeks · 0 commits
2 of 6 standards met
Issue description by Claude Summary The flag in node-prune only matches against the base filename/directory name () rather than the full path, making it impossible to exclude files or directories within specific node modules. Current Behavior When using the flag with glob patterns, the pattern is only matched against the filename or directory name, not the full path relative to the target directory. Source Code Reference:** Expected Behavior The exclude patterns should be able to match against the full relative path, allowing for more granular control over what gets excluded. Use Case Example When trying to preserve image assets in a specific package while still allowing pruning of images elsewhere: Problem Scenarios Scenario 1: Package-specific exclusions Scenario 2: Path-specific exclusions Current Workaround The only current workaround is to exclude the entire filename/directory name globally: This is too broad and prevents legitimate pruning in other locations. Proposed Solution Modify the exception matching logic to support both filename patterns and path-based patterns: Alternative Solution Add a separate flag that specifically matches against full paths, keeping the current behavior for backward compatibility.
Repository: tj/node-prune. Description: Remove unnecessary files from node_modules (.md, .ts, ...) Stars: 4447, Forks: 133. Primary language: Go. Languages: Go (100%). License: MIT. Latest release: v1.0.1 (8y ago). Open PRs: 5, open issues: 21. Last activity: 3y ago. Community health: 42%. Top contributors: tj, reggi, phanindra48, axetroy, jhegg, fengmk2, rokoroku, worst-developer, qWici, oguzhaninan and others.
Hello I am wondering if there is anyway to exclude certain node_modules or directories form being removed while running the prune, it seems to me that in this file it specifies ( https://github.com/tj/node-prune/blob/1159d4cac8090ca0b4a3d900ae81efb72558ea8a/internal/prune/prune.go#L92) that test directories are to be pruned and I have an instance in which I need keep my test folder, but it is getting pruned away. Thanks