Skip to content

fix(clean): support deno clean --dry-run without --except#34846

Merged
bartlomieju merged 2 commits into
mainfrom
fix/clean-dry-run-no-except
Jun 5, 2026
Merged

fix(clean): support deno clean --dry-run without --except#34846
bartlomieju merged 2 commits into
mainfrom
fix/clean-dry-run-no-except

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

Running deno clean --dry-run errored out because --dry-run required
--except to be passed alongside it, which is surprising: a dry run is
exactly when you would not want to commit to also cleaning everything
except some paths. It now works on its own and walks the cache directory
to report how many files and how much space would be removed, without
deleting anything.

This also closes a latent footgun: the no---except clean path never
consulted the dry_run flag, so simply relaxing the argument
requirement would have made --dry-run delete the whole cache. The
dry-run branch now short-circuits before any removal happens.

Closes #30031

Previously '--dry-run' required '--except', so 'deno clean --dry-run'
errored out. Allow it on its own: it now walks the cache directory,
reports how many files and how much space would be removed, and does
not delete anything.

Closes #30031
Run the no-`--except` dry-run through the same output path as a real
clean so it prints the identical `Removed <path> (<N> files, <size>)`
line, then a trailing `Aborting due to --dry-run flag` notice instead of
a separate `Would remove` wording.
@bartlomieju
bartlomieju merged commit 1567639 into main Jun 5, 2026
136 checks passed
@bartlomieju
bartlomieju deleted the fix/clean-dry-run-no-except branch June 5, 2026 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

deno clean --dry-run fails without --except present

1 participant