Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
},
"dependencies": {
"env-cmd": "^10.1.0",
"p-limit": "^4.0.0"
"p-ratelimit": "^1.0.1"
},
"devDependencies": {
"@types/jest": "^27.0.2",
Expand Down
21 changes: 7 additions & 14 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions src/helpers/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { promises as fs } from 'fs'
import { exec as execCallback } from 'child_process'
import pLimit from 'p-limit'
const { access } = fs
import { pRateLimit } from 'p-ratelimit'

export const limit = pRateLimit({
interval: 1000 * 10,
rate: 9,
concurrency: 3,
})

export const exists = (path: string): Promise<boolean> =>
access(path)
Expand All @@ -12,5 +18,3 @@ export const exec = (cmd: string): Promise<string> =>
new Promise((res, _rej) =>
execCallback(cmd, (_, stdout, stderr) => res(stdout + stderr)),
)

export const limit = pLimit(8)