Fix ignore pattern handling#3
Conversation
Adds a repeatable --ignore CLI option and support for ~/.config/dev-purge/config.json with an ignore array. Patterns are glob-like (supports ~ and **). Scanner respects ignore patterns when discovering projects and bloat dirs. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Nice fix, ship after one tweak. Notes: P1 — P2 — Move config read inside P2 — Guard empty pattern after P3 — Warn on invalid config entries P3 — Note case-sensitivity in README Nice catches in this PR
LGTM after P1. |
Summary
--ignoreglob handling so patterns like~/.vscode-server/**are parsed safely~,*,?, and**--ignoreusage and config support in the READMEdev-purgeinside a projectWhy this is needed
I run
dev-purgefrom a cron job, so ignore rules need to be reliable and non-interactive-safe. If an ignore pattern from CLI/config is malformed, unsupported, or interpreted too narrowly, the scheduled cleanup can either scan paths that should be excluded or fail unexpectedly. This makes folder exclusion predictable for automated runs.Ignore examples now supported
dev-purge --ignore node_modules dev-purge --ignore ./legacy-app dev-purge --ignore '~/Library/Caches/**'Config file:
{ ignore: [~/.vscode-server/**, ./vendor] }Checks
node --check src/scanner.jsnode --check src/index.jsnpm start -- --dry-run --depth 0 -s 0 --ignore node_modulesexcludes rootnode_modules