npm del 9.0.0

latest release: 9.0.1
3 hours ago

Breaking

  • Require Node.js 22 cf6ca0b
  • Upgrade to globby 16 cf6ca0b
    • With gitignore: true, the .gitignore files from the Git repository root down to cwd now apply too.
  • Keep the directories that hold excluded paths (#51) 0e86101
    • deleteSync(['dist', '!dist/keep']) now keeps dist/keep and deletes the rest of dist. Before, it deleted all of dist. This also applies to paths excluded by the ignore, gitignore, ignoreFiles, and globalGitignore options. Learn more
  • Refuse to delete a directory that contains the process working directory, or a path reached through a symlink that points outside cwd, unless force is set d682fb1 2183e81
  • Remove the objectMode and stats options from the types, as del only returns paths c6d8727

Improvements

  • Limit concurrency to 256 deletions at a time by default, instead of Infinity (#60) d385067
    • The most optimal default from a lot of testing.
  • Check every matched path before deleting anything 3856aad
    • Before, a path outside cwd was only refused after other paths were already deleted.
  • Retry a deletion up to 3 times on temporary errors like EBUSY and EPERM, which occur on Windows 2183e81
  • Document the cwd option c6d8727

Fixes

  • Fix deleteSync ignoring the onProgress option ca02fc3
  • Make deleteAsync wait 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 cwd option a27329d
  • Fix an undefined value for expandDirectories, onlyFiles, or followSymbolicLinks overriding the del defaults 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.


v8.0.1...v9.0.0

Don't miss a new del release

NewReleases is sending notifications on new releases.