Development Workflow
Requirements
- Node.js 20+
- pnpm 10+ (see
package.json)
bash
pnpm installScripts
| Command | Description |
|---|---|
pnpm test | Run Vitest (test/emitter.test.ts) with coverage output. |
pnpm lint | ESLint with auto-fix for src/. |
pnpm build | Build ESM + IIFE bundles and .d.ts files. |
pnpm docs:dev / docs:build | Work on or build the VitePress docs. |
pnpm release | Runs tests, builds, and updates the changelog via changelogen. |
Workflow
pnpm test --watchwhen touchingsrc/index.tsto catch regressions around listener bookkeeping.- Update docs (
README.md,docs/) in the same PR to keep API guidance current. pnpm buildbefore publishing to ensure bundles + types remain valid.pnpm docs:buildif you edited docs to catch MD/TSX issues.
Coverage & debugging
- Vitest coverage lives in
coverage/. Opencoverage/index.htmlto inspect missing branches. - Use
vitest --runInBandwhen debugging race conditions or synchronous edge cases. - Add temporary logs around
emit/offwhile debugging; remove before committing.
Contributing tips
- Preserve the typed tuple contract when adding features. Breaking it is a major version change.
- Expand the test suite with scenarios such as nested emits, listener removal during dispatch, etc.
- Document behavior changes in
CHANGELOG.mdand highlight them in the README.