chore: remove walkdir dev dependency (#42591)

This commit is contained in:
Charles Kerr 2024-06-21 09:31:10 -05:00 committed by GitHub
parent ba8ad4716b
commit 24d6c28b5a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 19 deletions

View file

@ -1,14 +1,11 @@
import { once } from 'node:events'; import * as fs from 'node:fs';
import * as walkdir from 'walkdir'; import * as path from 'node:path';
export async function getFiles (directoryPath: string, { filter = null }: {filter?: ((file: string) => boolean) | null} = {}) { export async function getFiles (
const files: string[] = []; dir: string,
const walker = walkdir(directoryPath, { test: ((file: string) => boolean) = (_: string) => true // eslint-disable-line @typescript-eslint/no-unused-vars
no_recurse: true ): Promise<string[]> {
}); return fs.promises.readdir(dir)
walker.on('file', (file) => { .then(files => files.map(file => path.join(dir, file)))
if (!filter || filter(file)) { files.push(file); } .then(files => files.filter(file => test(file)));
});
await once(walker, 'end');
return files;
} }

View file

@ -148,7 +148,7 @@ app.whenReady().then(async () => {
}; };
const { getFiles } = require('./get-files'); const { getFiles } = require('./get-files');
const testFiles = await getFiles(__dirname, { filter }); const testFiles = await getFiles(__dirname, filter);
for (const file of testFiles.sort()) { for (const file of testFiles.sort()) {
mocha.addFile(file); mocha.addFile(file);
} }

View file

@ -35,7 +35,6 @@
"split": "^1.0.1", "split": "^1.0.1",
"temp": "^0.9.0", "temp": "^0.9.0",
"uuid": "^3.3.3", "uuid": "^3.3.3",
"walkdir": "^0.3.2",
"winreg": "1.2.4", "winreg": "1.2.4",
"ws": "^7.4.6", "ws": "^7.4.6",
"yargs": "^16.0.3" "yargs": "^16.0.3"

View file

@ -2037,11 +2037,6 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0" spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0" spdx-expression-parse "^3.0.0"
walkdir@^0.3.2:
version "0.3.2"
resolved "https://registry.yarnpkg.com/walkdir/-/walkdir-0.3.2.tgz#ac8437a288c295656848ebc19981ebc677a5f590"
integrity sha512-0Twghia4Z5wDGDYWURlhZmI47GvERMCsXIu0QZWVVZyW9ZjpbbZvD9Zy9M6cWiQQRRbAcYajIyKNavaZZDt1Uw==
web-streams-polyfill@^3.2.1: web-streams-polyfill@^3.2.1:
version "3.3.3" version "3.3.3"
resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b" resolved "https://registry.yarnpkg.com/web-streams-polyfill/-/web-streams-polyfill-3.3.3.tgz#2073b91a2fdb1fbfbd401e7de0ac9f8214cecb4b"