Skip to content

Commit e02a96b

Browse files
committedJul 19, 2022
Meta tweaks
1 parent 106d7d8 commit e02a96b

File tree

7 files changed

+35
-29
lines changed

7 files changed

+35
-29
lines changed
 

‎.github/workflows/main.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,16 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
node-version:
13+
- 18
1314
- 16
1415
- 14
1516
os:
1617
- ubuntu-latest
1718
- macos-latest
1819
- windows-latest
1920
steps:
20-
- uses: actions/checkout@v2
21-
- uses: actions/setup-node@v1
21+
- uses: actions/checkout@v3
22+
- uses: actions/setup-node@v3
2223
with:
2324
node-version: ${{ matrix.node-version }}
2425
- run: npm install

‎benchmark.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@ import path from 'node:path';
22
import process from 'node:process';
33
import Benchmark from 'benchmark';
44
import makeDir from 'make-dir';
5-
import tempy from 'tempy';
5+
import {temporaryDirectory} from 'tempy';
66
import {deleteAsync, deleteSync} from './index.js';
77

88
const suite = new Benchmark.Suite('concurrency');
99

10-
const temporaryDir = tempy.directory();
10+
const temporaryDirectoryPath = temporaryDirectory();
1111

12-
const fixtures = Array.from({length: 2000}, (_, index) => path.resolve(temporaryDir, (index + 1).toString()));
12+
const fixtures = Array.from({length: 2000}, (_, index) => path.resolve(temporaryDirectoryPath, (index + 1).toString()));
1313

1414
function createFixtures() {
1515
for (const fixture of fixtures) {
16-
makeDir.sync(path.resolve(temporaryDir, fixture));
16+
makeDir.sync(path.resolve(temporaryDirectoryPath, fixture));
1717
}
1818
}
1919

@@ -47,7 +47,7 @@ for (const concurrency of concurrencies) {
4747
createFixtures();
4848

4949
const removedFiles = await deleteAsync(['**/*'], {
50-
cwd: temporaryDir,
50+
cwd: temporaryDirectoryPath,
5151
concurrency,
5252
});
5353

@@ -58,7 +58,7 @@ for (const concurrency of concurrencies) {
5858

5959
console.error(error);
6060

61-
deleteSync(temporaryDir, {cwd: temporaryDir, force: true});
61+
deleteSync(temporaryDirectoryPath, {cwd: temporaryDirectoryPath, force: true});
6262

6363
// eslint-disable-next-line unicorn/no-process-exit
6464
process.exit(1);
@@ -76,6 +76,6 @@ suite
7676
.on('complete', function () {
7777
console.log(`Fastest is ${this.filter('fastest').map('name')}`);
7878

79-
deleteSync(temporaryDir, {cwd: temporaryDir, force: true});
79+
deleteSync(temporaryDirectoryPath, {cwd: temporaryDirectoryPath, force: true});
8080
})
8181
.run({async: true});

‎index.d.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
import {GlobbyOptions} from 'globby';
1+
import {Options as GlobbyOptions} from 'globby';
22

33
export interface ProgressData {
44
/**
55
Deleted files and directories count.
66
*/
7-
deletedCount: number;
7+
readonly deletedCount: number;
88

99
/**
1010
Total files and directories count.
1111
*/
12-
totalCount: number;
12+
readonly totalCount: number;
1313

1414
/**
1515
Completed percentage. A value between `0` and `1`.
1616
*/
17-
percent: number;
17+
readonly percent: number;
1818
}
1919

2020
export interface Options extends GlobbyOptions {

‎index.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {promisify} from 'node:util';
22
import path from 'node:path';
33
import process from 'node:process';
4-
import globby from 'globby';
4+
import {globby, globbySync} from 'globby';
55
import isGlob from 'is-glob';
66
import slash from 'slash';
77
import gracefulFs from 'graceful-fs';
@@ -116,7 +116,7 @@ export function deleteSync(patterns, {force, dryRun, cwd = process.cwd(), ...opt
116116

117117
patterns = normalizePatterns(patterns);
118118

119-
const files = globby.sync(patterns, options)
119+
const files = globbySync(patterns, options)
120120
.sort((a, b) => b.localeCompare(a));
121121

122122
const removedFiles = files.map(file => {

‎package.json

+15-10
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@
1212
},
1313
"type": "module",
1414
"exports": "./index.js",
15+
"types": "./index.d.ts",
1516
"engines": {
16-
"node": "^14.13.1 || >=16.0.0"
17+
"node": ">=14.16"
1718
},
1819
"scripts": {
19-
"test": "xo && ava --serial --no-worker-threads && tsd",
20+
"test": "xo && ava && tsd",
2021
"bench": "node benchmark.js"
2122
},
2223
"files": [
@@ -48,21 +49,25 @@
4849
"filesystem"
4950
],
5051
"dependencies": {
51-
"globby": "^11.0.1",
52-
"graceful-fs": "^4.2.4",
53-
"is-glob": "^4.0.1",
54-
"is-path-cwd": "^2.2.0",
55-
"is-path-inside": "^3.0.2",
56-
"p-map": "^4.0.0",
52+
"globby": "^13.1.2",
53+
"graceful-fs": "^4.2.10",
54+
"is-glob": "^4.0.3",
55+
"is-path-cwd": "^3.0.0",
56+
"is-path-inside": "^4.0.0",
57+
"p-map": "^5.5.0",
5758
"rimraf": "^3.0.2",
58-
"slash": "^3.0.0"
59+
"slash": "^4.0.0"
5960
},
6061
"devDependencies": {
6162
"ava": "^4.3.1",
6263
"benchmark": "^2.1.4",
6364
"make-dir": "^3.1.0",
64-
"tempy": "^0.7.0",
65+
"tempy": "^3.0.0",
6566
"tsd": "^0.22.0",
6667
"xo": "^0.50.0"
68+
},
69+
"ava": {
70+
"serial": true,
71+
"workerThreads": false
6772
}
6873
}

‎readme.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ Similar to [rimraf](https://github.com/isaacs/rimraf), but with a Promise API an
66

77
## Install
88

9-
```
10-
$ npm install del
9+
```sh
10+
npm install del
1111
```
1212

1313
## Usage

‎test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import fs from 'node:fs';
33
import path from 'node:path';
44
import process from 'node:process';
55
import test from 'ava';
6-
import tempy from 'tempy';
6+
import {temporaryDirectory} from 'tempy';
77
import makeDir from 'make-dir';
88
import {deleteAsync, deleteSync} from './index.js';
99

@@ -31,7 +31,7 @@ const fixtures = [
3131
];
3232

3333
test.beforeEach(t => {
34-
t.context.tmp = tempy.directory();
34+
t.context.tmp = temporaryDirectory();
3535

3636
for (const fixture of fixtures) {
3737
makeDir.sync(path.join(t.context.tmp, fixture));

0 commit comments

Comments
 (0)
Please sign in to comment.