Skip to content

Commit 694be7e

Browse files
committed
[fix-vendored-twsearch.ts] Skip directory nodes when copying/fixing files.
We need to exclude these due to a `bun` change that brought it in line with `node`, which is due to an unrelated issue I filed: oven-sh/bun#20507
1 parent 0b9b430 commit 694be7e

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

script/fix-vendored-twsearch.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ const DIR = fileURLToPath(
66
new URL("../src/cubing/vendor/mpl/twsearch", import.meta.url),
77
);
88

9-
for (const fileName of await readdir(DIR)) {
10-
const filePath = join(DIR, fileName);
9+
for (const dirEnt of await readdir(DIR, {
10+
withFileTypes: true,
11+
recursive: true,
12+
})) {
13+
const { parentPath, name: fileName } = dirEnt;
14+
// Note: we call this on `dirEnt` instead of destructuring `isDirectory` above, because that would produce an incorrect result: https://github.com/oven-sh/bun/issues/21099
15+
if (dirEnt.isDirectory()) {
16+
continue;
17+
}
18+
const filePath = join(parentPath, fileName);
1119
console.log("Fixing:", filePath);
1220
let contents = await readFile(filePath, "utf-8");
1321
switch (fileName) {

0 commit comments

Comments
 (0)