Development Workflow
Follow these steps to work on @avensio/async-pool, run tests, and update documentation.
Prerequisites
- Node.js 20+
- pnpm 10+ (
package.jsonpinspnpm@10.20.0)
Install dependencies at the repo root:
bash
pnpm installScripts
| Command | Description |
|---|---|
pnpm test | Runs Vitest over test/pool.test.ts with coverage output in coverage/. |
pnpm lint | ESLint with auto-fix enabled via eslint.config.mjs. |
pnpm build | Builds the ESM, CJS, and IIFE bundles (dist/) and refreshes type declarations (dist/pool.es.d.ts). |
pnpm docs:dev | Launches VitePress for the docs folder. |
pnpm docs:build / pnpm docs:preview | Generate and review the static docs site. |
pnpm release | Runs tests, builds artifacts, and updates the changelog using changelogen. |
Recommended loop
pnpm test --watchwhile modifyingsrc/index.tsso you catch concurrency regressions early.- Update docs (
README.md,docs/) alongside code changes to keep guidance accurate. - Run
pnpm buildbefore publishing to ensure the bundler and DTS generation still succeed. - Build docs (
pnpm docs:build) if you touched the documentation site to catch markdown/front-matter issues.
Coverage & debugging tips
- Open
coverage/index.htmlto inspect which branches remain untested. - Use
vitest --runInBandfor deterministic scheduling when debugging race conditions. - Insert temporary logging in
src/index.tsto inspect queue depth; remove before committing.
Contributing
- Keep the public API surface (
createPool) backward-compatible; add new helpers in separate modules if necessary. - Extend the Vitest suite when fixing bugs—especially around error propagation or queue fairness.
- Note changes in
CHANGELOG.md(or rely onpnpm release) and mention user-facing behavior updates in the docs.