-
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
227 additions
and
239 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,9 +10,8 @@ jobs: | |
fail-fast: false | ||
matrix: | ||
node-version: | ||
- 16 | ||
- 14 | ||
- 12 | ||
- 10 | ||
os: | ||
- ubuntu-latest | ||
- macos-latest | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,116 +1,106 @@ | ||
import {GlobbyOptions} from 'globby'; | ||
|
||
declare namespace del { | ||
interface ProgressData { | ||
/** | ||
Deleted files and directories count. | ||
*/ | ||
deletedCount: number; | ||
|
||
/** | ||
Total files and directories count. | ||
*/ | ||
totalCount: number; | ||
|
||
/** | ||
Completed percentage. A value between `0` and `1`. | ||
*/ | ||
percent: number; | ||
} | ||
|
||
interface Options extends GlobbyOptions { | ||
/** | ||
Allow deleting the current working directory and outside. | ||
@default false | ||
*/ | ||
readonly force?: boolean; | ||
|
||
/** | ||
See what would be deleted. | ||
@default false | ||
@example | ||
``` | ||
import del = require('del'); | ||
(async () => { | ||
const deletedPaths = await del(['temp/*.js'], {dryRun: true}); | ||
console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n')); | ||
})(); | ||
``` | ||
*/ | ||
readonly dryRun?: boolean; | ||
|
||
/** | ||
Concurrency limit. Minimum: `1`. | ||
@default Infinity | ||
*/ | ||
readonly concurrency?: number; | ||
|
||
/** | ||
Called after each file or directory is deleted. | ||
@example | ||
``` | ||
import del from 'del'; | ||
await del(patterns, { | ||
onProgress: progress => { | ||
// … | ||
}}); | ||
``` | ||
*/ | ||
readonly onProgress?: (progress: ProgressData) => void; | ||
} | ||
export interface ProgressData { | ||
/** | ||
Deleted files and directories count. | ||
*/ | ||
deletedCount: number; | ||
|
||
/** | ||
Total files and directories count. | ||
*/ | ||
totalCount: number; | ||
|
||
/** | ||
Completed percentage. A value between `0` and `1`. | ||
*/ | ||
percent: number; | ||
} | ||
|
||
declare const del: { | ||
export interface Options extends GlobbyOptions { | ||
/** | ||
Synchronously delete files and directories using glob patterns. | ||
Allow deleting the current working directory and outside. | ||
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()`. | ||
@default false | ||
*/ | ||
readonly force?: boolean; | ||
|
||
/** | ||
See what would be deleted. | ||
@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/main/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. | ||
@default false | ||
@example | ||
``` | ||
import {deleteAsync} from 'del'; | ||
const deletedPaths = await deleteAsync(['temp/*.js'], {dryRun: true}); | ||
console.log('Files and directories that would be deleted:\n', deletedPaths.join('\n')); | ||
``` | ||
*/ | ||
sync: ( | ||
patterns: string | readonly string[], | ||
options?: del.Options | ||
) => string[]; | ||
readonly dryRun?: boolean; | ||
|
||
/** | ||
Delete files and directories using glob patterns. | ||
Concurrency limit. Minimum: `1`. | ||
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()`. | ||
@default Infinity | ||
*/ | ||
readonly concurrency?: number; | ||
|
||
@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/main/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. | ||
/** | ||
Called after each file or directory is deleted. | ||
@example | ||
``` | ||
import del = require('del'); | ||
import {deleteAsync} from 'del'; | ||
(async () => { | ||
const deletedPaths = await del(['temp/*.js', '!temp/unicorn.js']); | ||
console.log('Deleted files and directories:\n', deletedPaths.join('\n')); | ||
})(); | ||
await deleteAsync(patterns, { | ||
onProgress: progress => { | ||
// … | ||
}}); | ||
``` | ||
*/ | ||
( | ||
patterns: string | readonly string[], | ||
options?: del.Options | ||
): Promise<string[]>; | ||
}; | ||
readonly onProgress?: (progress: ProgressData) => void; | ||
} | ||
|
||
export = del; | ||
/** | ||
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/main/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. | ||
@example | ||
``` | ||
import {deleteAsync} from 'del'; | ||
const deletedPaths = await deleteAsync(['temp/*.js', '!temp/unicorn.js']); | ||
console.log('Deleted files and directories:\n', deletedPaths.join('\n')); | ||
``` | ||
*/ | ||
export function deleteAsync( | ||
patterns: string | readonly string[], | ||
options?: Options | ||
): Promise<string[]>; | ||
|
||
/** | ||
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/main/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. | ||
*/ | ||
export function deleteSync( | ||
patterns: string | readonly string[], | ||
options?: Options | ||
): string[]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.