diff --git a/benchmark.js b/benchmark.js index 411795d..6b45567 100644 --- a/benchmark.js +++ b/benchmark.js @@ -1,7 +1,7 @@ +import fs from 'node:fs'; import path from 'node:path'; import process from 'node:process'; import Benchmark from 'benchmark'; -import {makeDirectorySync} from 'make-dir'; import {temporaryDirectory} from 'tempy'; import {deleteAsync, deleteSync} from './index.js'; @@ -13,7 +13,7 @@ const fixtures = Array.from({length: 2000}, (_, index) => path.resolve(temporary function createFixtures() { for (const fixture of fixtures) { - makeDirectorySync(path.resolve(temporaryDirectoryPath, fixture)); + fs.mkdirSync(path.resolve(temporaryDirectoryPath, fixture), {recursive: true}); } } diff --git a/package.json b/package.json index 60f0de7..0e31f7e 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,6 @@ "devDependencies": { "ava": "^6.1.3", "benchmark": "^2.1.4", - "make-dir": "^5.0.0", "tempy": "^3.1.0", "tsd": "^0.31.0", "xo": "^0.58.0" @@ -68,10 +67,5 @@ "ava": { "serial": true, "workerThreads": false - }, - "xo": { - "rules": { - "unicorn/prefer-string-replace-all": "off" - } } } diff --git a/test.js b/test.js index fb1b397..610b4b8 100644 --- a/test.js +++ b/test.js @@ -4,7 +4,6 @@ import path from 'node:path'; import process from 'node:process'; import test from 'ava'; import {temporaryDirectory} from 'tempy'; -import {makeDirectorySync} from 'make-dir'; import {deleteAsync, deleteSync} from './index.js'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); @@ -34,7 +33,7 @@ test.beforeEach(t => { t.context.tmp = temporaryDirectory(); for (const fixture of fixtures) { - makeDirectorySync(path.join(t.context.tmp, fixture)); + fs.mkdirSync(path.join(t.context.tmp, fixture), {recursive: true}); } }); @@ -125,7 +124,7 @@ test('does not throw EINVAL - async', async t => { let count = 0; while (count !== totalAttempts) { - makeDirectorySync(nestedFile); + fs.mkdirSync(nestedFile, {recursive: true}); // eslint-disable-next-line no-await-in-loop const removed = await deleteAsync('**/*', { @@ -160,7 +159,7 @@ test('does not throw EINVAL - sync', t => { let count = 0; while (count !== totalAttempts) { - makeDirectorySync(nestedFile); + fs.mkdirSync(nestedFile, {recursive: true}); const removed = deleteSync('**/*', { cwd: t.context.tmp, @@ -337,7 +336,7 @@ test('windows can pass absolute paths with "\\" - sync', t => { test('windows can pass relative paths with "\\" - async', async t => { const nestedFile = path.resolve(t.context.tmp, 'a/b/c/nested.js'); - makeDirectorySync(nestedFile); + fs.mkdirSync(nestedFile, {recursive: true}); const removeFiles = await deleteAsync([nestedFile], {cwd: t.context.tmp, dryRun: true}); @@ -346,7 +345,7 @@ test('windows can pass relative paths with "\\" - async', async t => { test('windows can pass relative paths with "\\" - sync', t => { const nestedFile = path.resolve(t.context.tmp, 'a/b/c/nested.js'); - makeDirectorySync(nestedFile); + fs.mkdirSync(nestedFile, {recursive: true}); const removeFiles = deleteSync([nestedFile], {cwd: t.context.tmp, dryRun: true}); @@ -389,7 +388,7 @@ test('onProgress option - progress of single file', async t => { test('onProgress option - progress of multiple files', async t => { const reports = []; - const sourcePath = process.platform === 'win32' ? path.resolve(`${t.context.tmp}/*`).replace(/\\/g, '/') : `${t.context.tmp}/*`; + const sourcePath = process.platform === 'win32' ? path.resolve(`${t.context.tmp}/*`).replaceAll('\\', '/') : `${t.context.tmp}/*`; await deleteAsync(sourcePath, { cwd: __dirname,