Breaking
- Require Node.js 22 cf6ca0b
- Upgrade to globby 16 cf6ca0b
- With
gitignore: true, the.gitignorefiles from the Git repository root down tocwdnow apply too.
- With
- Keep the directories that hold excluded paths (#51) 0e86101
deleteSync(['dist', '!dist/keep'])now keepsdist/keepand deletes the rest ofdist. Before, it deleted all ofdist. This also applies to paths excluded by theignore,gitignore,ignoreFiles, andglobalGitignoreoptions. Learn more
- Refuse to delete a directory that contains the process working directory, or a path reached through a symlink that points outside
cwd, unlessforceis set d682fb1 2183e81 - Remove the
objectModeandstatsoptions from the types, asdelonly returns paths c6d8727
Improvements
- Limit
concurrencyto 256 deletions at a time by default, instead ofInfinity(#60) d385067- The most optimal default from a lot of testing.
- Check every matched path before deleting anything 3856aad
- Before, a path outside
cwdwas only refused after other paths were already deleted.
- Before, a path outside
- Retry a deletion up to 3 times on temporary errors like
EBUSYandEPERM, which occur on Windows 2183e81 - Document the
cwdoption c6d8727
Fixes
- Fix
deleteSyncignoring theonProgressoption ca02fc3 - Make
deleteAsyncwait for running deletions to finish before it rejects (#98) dd78adb - Fix a path being returned twice for patterns that differ only by a trailing slash a10c038
- Fix the wrong error message when deleting the directory given in the
cwdoption a27329d - Fix an
undefinedvalue forexpandDirectories,onlyFiles, orfollowSymbolicLinksoverriding thedeldefaults cbf1ce1
Migration guide
Excluded paths keep their directories
A negation inside a matched directory now protects that path. Before, you had to also exclude the parent directories:
-deleteSync(['public/assets/**', '!public/assets', '!public/assets/goat.png']);
+deleteSync(['public/assets/**', '!public/assets/goat.png']);The returned paths change accordingly: deleteSync(['dist', '!dist/keep']) returns dist/other instead of dist.