INNER CODE UNIT · JavaScript
workers
ImranR98/apps.obtainium.imranr.dev · scripts/validate_icons.js:119
const workers = Array.from({ length: Math.min(limit, queue.length) }, async () => {
while (queue.length) {
const item = queue.shift()
await worker(item)
}
})
await Promise.all(workers)
}
async function main() {
const files = targetPaths.length
? targetPaths.flatMap(target => {
const stat = fs.statSync(target)
return stat.isDirectory() ? getAllJsonFiles(target) : [target]
})
: getAllJsonFiles(APPS_DIR)
console.log(`Found ${files.length} JSON files`)