Skip to content

Commit

Permalink
Require Node.js 10
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Sep 26, 2020
1 parent 1df5280 commit 6c99805
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 37 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ os:
- windows
language: node_js
node_js:
- '14'
- '12'
- '10'
- '8'
14 changes: 7 additions & 7 deletions benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

Expand Down Expand Up @@ -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);
Expand All @@ -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});
32 changes: 16 additions & 16 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -63,22 +79,6 @@ declare const del: {
patterns: string | readonly string[],
options?: del.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/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;
2 changes: 1 addition & 1 deletion license
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com)
Copyright (c) Sindre Sorhus <[email protected]> (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:

Expand Down
25 changes: 13 additions & 12 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]",
"url": "sindresorhus.com"
"url": "https://sindresorhus.com"
},
"engines": {
"node": ">=8"
"node": ">=10"
},
"scripts": {
"test": "xo && ava && tsd",
Expand Down Expand Up @@ -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"
}
}

0 comments on commit 6c99805

Please sign in to comment.