Skip to content

Commit

Permalink
chore: remove fastq
Browse files Browse the repository at this point in the history
  • Loading branch information
gurgunday committed Jul 15, 2024
1 parent 81b38f5 commit 287c59b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
17 changes: 6 additions & 11 deletions bin/src/utils.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { createHash } from "node:crypto";
import { readFile, writeFile } from "node:fs/promises";
import { win32, posix } from "node:path";
import { cpus } from "node:os";
import { Glob } from "glob";
import { promise as fastq } from "fastq";
const fastqConcurrency = Math.max(1, cpus().length - 1);

const generateFileHash = async (filePath) => {
try {
Expand Down Expand Up @@ -91,10 +88,8 @@ const generateHashesAndReplace = async ({
rootPath += "/";
}

const queue = fastq(generateFileHash, fastqConcurrency);
const queuePromises = [];
const queue = [];
const files = [];

const filesIterable = new Glob("**/**", {
nodir: true,
follow: true,
Expand All @@ -104,13 +99,13 @@ const generateHashesAndReplace = async ({
ignore: skipPatterns,
});

for await (let file of filesIterable) {
file = file.split(win32.sep).join(posix.sep);
files.push(file);
queuePromises.push(queue.push(file));
for await (let filePath of filesIterable) {

Check warning on line 102 in bin/src/utils.js

View workflow job for this annotation

GitHub Actions / test (^18)

Unexpected `await` inside a loop

Check warning on line 102 in bin/src/utils.js

View workflow job for this annotation

GitHub Actions / test (lts/*)

Unexpected `await` inside a loop
filePath = filePath.split(win32.sep).join(posix.sep);
queue.push(generateFileHash(filePath));
files.push(filePath);
}

const hashes = await Promise.all(queuePromises);
const hashes = await Promise.all(queue);

Check warning on line 108 in bin/src/utils.js

View workflow job for this annotation

GitHub Actions / test (^18)

Unexpected `await` inside a loop

Check warning on line 108 in bin/src/utils.js

View workflow job for this annotation

GitHub Actions / test (lts/*)

Unexpected `await` inside a loop

for (let i = 0; i < files.length; i++) {
const fileRelativePath = posix.relative(rootPath, files[i]);
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"lint:fix": "eslint --fix . && prettier --write ."
},
"dependencies": {
"fastq": "^1.17.1",
"glob": "^10.4.2"
},
"devDependencies": {
Expand Down

0 comments on commit 287c59b

Please sign in to comment.