diff --git a/.travis.yml b/.travis.yml index 29ef4bf..0509c62 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,6 +4,6 @@ os: - windows language: node_js node_js: + - '14' - '12' - '10' - - '8' diff --git a/benchmark.js b/benchmark.js index 7b6a881..3d194fb 100644 --- a/benchmark.js +++ b/benchmark.js @@ -7,15 +7,15 @@ const del = require('.'); const suite = new Benchmark.Suite('concurrency'); -const tempDir = tempy.directory(); +const temporaryDir = tempy.directory(); const fixtures = Array.from({length: 2000}, (_, index) => { - return path.resolve(tempDir, (index + 1).toString()); + return path.resolve(temporaryDir, (index + 1).toString()); }); function createFixtures() { for (const fixture of fixtures) { - makeDir.sync(path.resolve(tempDir, fixture)); + makeDir.sync(path.resolve(temporaryDir, fixture)); } } @@ -49,18 +49,18 @@ for (const concurrency of concurrencies) { createFixtures(); const removedFiles = await del(['**/*'], { - cwd: tempDir, + cwd: temporaryDir, concurrency }); if (removedFiles.length !== fixtures.length) { const error = new Error( - `"${name}": files removed: ${removedFiles.length}, expected: ${fixtures.length}`, + `"${name}": files removed: ${removedFiles.length}, expected: ${fixtures.length}` ); console.error(error); - del.sync(tempDir, {cwd: tempDir, force: true}); + del.sync(temporaryDir, {cwd: temporaryDir, force: true}); // eslint-disable-next-line unicorn/no-process-exit process.exit(1); @@ -78,6 +78,6 @@ suite .on('complete', function () { console.log(`Fastest is ${this.filter('fastest').map('name')}`); - del.sync(tempDir, {cwd: tempDir, force: true}); + del.sync(temporaryDir, {cwd: temporaryDir, force: true}); }) .run({async: true}); diff --git a/index.d.ts b/index.d.ts index b4d9767..07b5484 100644 --- a/index.d.ts +++ b/index.d.ts @@ -37,6 +37,22 @@ declare namespace del { } declare const del: { + /** + Synchronously delete files and directories using glob patterns. + + Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`. + + @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). + - [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js) + - [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) + @param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default. + @returns The deleted paths. + */ + sync: ( + patterns: string | readonly string[], + options?: del.Options + ) => string[]; + /** Delete files and directories using glob patterns. @@ -63,22 +79,6 @@ declare const del: { patterns: string | readonly string[], options?: del.Options ): Promise; - - /** - Synchronously delete files and directories using glob patterns. - - Note that glob patterns can only contain forward-slashes, not backward-slashes. Windows file paths can use backward-slashes as long as the path does not contain any glob-like characters, otherwise use `path.posix.join()` instead of `path.join()`. - - @param patterns - See the supported [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). - - [Pattern examples with expected matches](https://github.com/sindresorhus/multimatch/blob/master/test/test.js) - - [Quick globbing pattern overview](https://github.com/sindresorhus/multimatch#globbing-patterns) - @param options - You can specify any of the [`globby` options](https://github.com/sindresorhus/globby#options) in addition to the `del` options. In contrast to the `globby` defaults, `expandDirectories`, `onlyFiles`, and `followSymbolicLinks` are `false` by default. - @returns The deleted paths. - */ - sync( - patterns: string | readonly string[], - options?: del.Options - ): string[]; }; export = del; diff --git a/license b/license index e7af2f7..fa7ceba 100644 --- a/license +++ b/license @@ -1,6 +1,6 @@ MIT License -Copyright (c) Sindre Sorhus (sindresorhus.com) +Copyright (c) Sindre Sorhus (https://sindresorhus.com) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: diff --git a/package.json b/package.json index ad41ccf..828524a 100644 --- a/package.json +++ b/package.json @@ -4,13 +4,14 @@ "description": "Delete files and directories", "license": "MIT", "repository": "sindresorhus/del", + "funding": "https://github.com/sponsors/sindresorhus", "author": { "name": "Sindre Sorhus", "email": "sindresorhus@gmail.com", - "url": "sindresorhus.com" + "url": "https://sindresorhus.com" }, "engines": { - "node": ">=8" + "node": ">=10" }, "scripts": { "test": "xo && ava && tsd", @@ -45,21 +46,21 @@ "filesystem" ], "dependencies": { - "globby": "^10.0.1", - "graceful-fs": "^4.2.2", + "globby": "^11.0.1", + "graceful-fs": "^4.2.4", "is-glob": "^4.0.1", "is-path-cwd": "^2.2.0", - "is-path-inside": "^3.0.1", - "p-map": "^3.0.0", - "rimraf": "^3.0.0", + "is-path-inside": "^3.0.2", + "p-map": "^4.0.0", + "rimraf": "^3.0.2", "slash": "^3.0.0" }, "devDependencies": { - "ava": "^2.3.0", + "ava": "^2.4.0", "benchmark": "^2.1.4", - "make-dir": "^3.0.0", - "tempy": "^0.3.0", - "tsd": "^0.7.4", - "xo": "^0.24.0" + "make-dir": "^3.1.0", + "tempy": "^0.7.0", + "tsd": "^0.13.1", + "xo": "^0.33.1" } }