Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: sindresorhus/del
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v6.1.0
Choose a base ref
...
head repository: sindresorhus/del
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v6.1.1
Choose a head ref
  • 2 commits
  • 3 files changed
  • 2 contributors

Commits on May 24, 2022

  1. Verified

    This commit was signed with the committer’s verified signature.
    AtofStryker Bill Glesias
    Copy the full SHA
    7b4c881 View commit details
  2. 6.1.1

    sindresorhus committed May 24, 2022

    Verified

    This commit was signed with the committer’s verified signature.
    AtofStryker Bill Glesias
    Copy the full SHA
    5de56fd View commit details
Showing with 10 additions and 12 deletions.
  1. +7 −9 index.js
  2. +1 −1 package.json
  3. +2 −2 readme.md
16 changes: 7 additions & 9 deletions index.js
Original file line number Diff line number Diff line change
@@ -74,7 +74,9 @@ module.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgres
});
}

const mapper = async (file, fileIndex) => {
let deletedCount = 0;

const mapper = async file => {
file = path.resolve(cwd, file);

if (!force) {
@@ -85,23 +87,19 @@ module.exports = async (patterns, {force, dryRun, cwd = process.cwd(), onProgres
await rimrafP(file, rimrafOptions);
}

deletedCount += 1;

onProgress({
totalCount: files.length,
deletedCount: fileIndex,
percent: fileIndex / files.length
deletedCount,
percent: deletedCount / files.length
});

return file;
};

const removedFiles = await pMap(files, mapper, options);

onProgress({
totalCount: files.length,
deletedCount: files.length,
percent: 1
});

removedFiles.sort((a, b) => a.localeCompare(b));

return removedFiles;
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "del",
"version": "6.1.0",
"version": "6.1.1",
"description": "Delete files and directories",
"license": "MIT",
"repository": "sindresorhus/del",
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -127,8 +127,8 @@ await del(patterns, {

```js
{
totalFiles: number,
deletedFiles: number,
totalCount: number,
deletedCount: number,
percent: number
}
```