Skip to content
Merged
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
7 changes: 0 additions & 7 deletions .eslintrc.cjs

This file was deleted.

14 changes: 0 additions & 14 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,19 +49,5 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Authenticate to Google Cloud
id: auth
if: matrix.command == 'test'
uses: google-github-actions/auth@v2
with:
workload_identity_provider: projects/447252512630/locations/global/workloadIdentityPools/github-actions/providers/github-actions-provider
service_account: github-actions-deployer@stafftraveler.iam.gserviceaccount.com

- name: Run ${{ matrix.command }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
GOOGLE_CLOUD_PROJECT: stafftraveler
GOOGLE_APPLICATION_CREDENTIALS:
${{ steps.auth.outputs.credentials_file_path }}
run: pnpm ${{ matrix.command }}
2 changes: 0 additions & 2 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
{
Comment thread
0x80 marked this conversation as resolved.
Resolved
"trailingComma": "es5",
"proseWrap": "always",
"plugins": ["./node_modules/prettier-plugin-jsdoc/dist/index.js"]
}
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { processInChunks } from "process-in-chunks";
// Process items in parallel chunks
const results = await processInChunks(
[1, 2, 3, 4, 5],
async (item) => item * 2
async (item) => item * 2,
);
console.log(results); // [2, 4, 6, 8, 10]
```
Expand All @@ -49,7 +49,7 @@ const results = await processInChunks(
async (item, index) => {
console.log(`Processing item ${index}, value ${item}`);
return item * 10;
}
},
);

console.log(results); // [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
Expand All @@ -69,7 +69,7 @@ const results = await processInChunksByChunk(
// Process entire chunk at once
return chunk.reduce((sum, item) => sum + item, 0);
},
{ chunkSize: 3, throttleSeconds: 1 }
{ chunkSize: 3, throttleSeconds: 1 },
);

console.log(results); // [6, 15, 24, 10] (after ~4 seconds)
Expand Down Expand Up @@ -115,7 +115,7 @@ const result = await processInChunks(
}
return `Processed: ${item}`;
},
{ noThrow: true }
{ noThrow: true },
);

if (result.hasErrors) {
Expand Down Expand Up @@ -235,7 +235,7 @@ const fileContents = await processInChunks(
const content = await readFile(filePath, "utf-8");
return { path: filePath, content, size: content.length };
},
{ chunkSize: 10 } // Process 10 files at a time
{ chunkSize: 10 }, // Process 10 files at a time
);
```

Expand All @@ -259,7 +259,7 @@ const users = await processInChunksByChunk(
{
chunkSize: 5, // 5 users per batch
throttleSeconds: 1, // 1 second between batches
}
},
);
```

Expand All @@ -277,14 +277,14 @@ const result = await processInChunks(
}
return num * 2;
},
{ noThrow: true }
{ noThrow: true },
);

if (result.hasErrors) {
console.log("Errors:", result.errorMessages);
console.log(
"Valid results:",
result.results.filter((r) => r !== undefined)
result.results.filter((r) => r !== undefined),
);
}
```
Expand Down Expand Up @@ -315,7 +315,7 @@ await processInChunks(
{
chunkSize: 50, // Process 50 events at a time
throttleSeconds: 0.5, // Small delay to avoid overwhelming the message system
}
},
);

console.log("All events published successfully!");
Expand Down
36 changes: 17 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@
"files": [
"dist"
],
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"main": "./dist/index.mjs",
"types": "./dist/index.d.mts",
Comment thread
0x80 marked this conversation as resolved.
Resolved
"exports": {
".": {
"types": "./dist/index.d.ts",
"default": "./dist/index.js"
Comment thread
0x80 marked this conversation as resolved.
Resolved
}
".": "./dist/index.mjs",
Comment thread
0x80 marked this conversation as resolved.
Resolved
"./package.json": "./package.json"
},
"publishConfig": {
"access": "public"
Expand All @@ -31,9 +29,9 @@
"node": ">=20"
},
"scripts": {
"lint": "eslint .",
"lint": "oxlint --type-aware",
"check-types": "tsc --noEmit",
"build": "tsup-node && tsc --emitDeclarationOnly && tsc-alias --verbose",
"build": "tsdown",
"clean": "del-cli dist tsconfig.tsbuildinfo",
"test": "vitest run",
"prepare": "pnpm clean && pnpm build",
Expand All @@ -43,18 +41,18 @@
"author": "Thijs Koerselman",
"license": "MIT",
"devDependencies": {
"@codecompose/typescript-config": "^1.2.0",
"@types/node": "^22.10.7",
"del-cli": "^6.0.0",
"eslint": "^8.57.1",
"eslint-config-0x80": "^0.0.0",
"@codecompose/typescript-config": "^2.2.0",
"@types/node": "^25.0.3",
"del-cli": "^7.0.0",
"get-or-throw": "^2.1.0",
"prettier": "^3.4.2",
"prettier-plugin-jsdoc": "^1.3.2",
"tsc-alias": "^1.8.10",
"tsup": "^8.3.5",
"typescript": "^5.7.3",
"oxlint": "^1.33.0",
"oxlint-tsgolint": "^0.9.1",
"prettier": "^3.7.4",
"prettier-plugin-jsdoc": "^1.8.0",
"tsdown": "^0.18.0",
"typescript": "^5.9.3",
Comment thread
0x80 marked this conversation as resolved.
Resolved
"vitest": "^4.0.16"
},
"packageManager": "pnpm@9.0.5+sha256.61bd66913b52012107ec25a6ee4d6a161021ab99e04f6acee3aa50d0e34b4af9"
"packageManager": "pnpm@9.0.5+sha256.61bd66913b52012107ec25a6ee4d6a161021ab99e04f6acee3aa50d0e34b4af9",
"module": "./dist/index.mjs"
}
Loading