Skip to content

Commit 5c0db47

Browse files
committed
limit parallel requests, show path for problem request in check-dependencies
1 parent 48cadf8 commit 5c0db47

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

scripts/check-dependencies/check-dependencies.mjs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { cpus } from 'node:os';
2+
13
const ignore = {
24
'core-js-builder': [
35
'mkdirp',
@@ -14,7 +16,7 @@ const pkgs = await glob([
1416
'@(packages|scripts|tests)/*/package.json',
1517
]);
1618

17-
await Promise.all(pkgs.map(async path => {
19+
async function checkPackage(path) {
1820
const { name = 'root', dependencies, devDependencies } = await fs.readJson(path);
1921
if (!dependencies && !devDependencies) return;
2022

@@ -33,6 +35,19 @@ await Promise.all(pkgs.map(async path => {
3335
echo(chalk.cyan(`${ name }:`));
3436
console.table(obsolete);
3537
}
38+
}
39+
40+
let i = 0;
41+
42+
await Promise.all(Array(cpus().length).fill().map(async () => {
43+
while (i < pkgs.length) {
44+
const path = pkgs[i++];
45+
try {
46+
await checkPackage(path);
47+
} catch {
48+
echo(chalk.red(`${ chalk.cyan(path) } check error`));
49+
}
50+
}
3651
}));
3752

3853
echo(chalk.green('dependencies checked'));

0 commit comments

Comments
 (0)