Contributor notes for the ReductStore JavaScript/TypeScript SDK. Keep changes scoped, documented, and reproducible.
src/holds the TypeScript source;src/httpwraps fetch requests and auth,src/messagesdefines request/response DTOs with parsing helpers, andsrc/utilscontains shared helpers.lib/esmandlib/cjsare generated build outputs; do not edit them directly—regenerate via the build.test/contains Jest suites (*.test.ts) mirroring the client surface;test/utilshosts shared fixtures.examples/has minimal usage snippets; update when adding notable features.coverage/is produced by Jest when coverage is enabled.
npm run tsccompiles the SDK to ESM and CJS and rewritessrc/version.tsfrompackage.json—run after bumping versions or touching types.npm testcompiles then runs Jest in-band (stable for async HTTP tests). Filter withnpm test -- Bucket.npm run lintenforces the ESLint ruleset;npm run fmtapplies Prettier;npm run fmt:checkvalidates formatting without writes.- Install deps with
npm install; Node.js 18+ is required.
- TypeScript-first, async/await APIs. Prefer
const, arrow callbacks, and destructuring (no-var,prefer-const,prefer-arrow-callbackare enforced). - Prettier defaults (2-space indent, double quotes, trailing commas where valid) plus ESLint (
@typescript-eslint+eslint:recommended+prettier). - Classes/types/interfaces use PascalCase (
Client,BucketSettings); functions, variables, and fields use camelCase. Align new DTOs with existingparse/serializehelpers insrc/messages. - Keep public API docs concise with JSDoc blocks; include examples for new methods.
- Jest with
ts-jest; place specs next to related modules undertest/using*.test.ts. - Aim for deterministic tests; prefer mocked fetch/HTTP interactions over live endpoints. Reuse helpers from
test/utils. - Add coverage when adding public APIs; run
npm test -- --coveragelocally before large changes.
- Use short, imperative subjects and reference issues/PRs when relevant (e.g.,
Add baseUrl argument (#123)); avoid committing generatedlibdiffs without a matching source change. - PRs should state what changed and why, list key commands run (
npm run tsc,npm test,npm run lint), and link related issues. Include doc updates for user-facing API shifts and CHANGELOG entries for release-worthy changes. - CHANGELOG.md must be updated for every PR (bug fixes, features, docs) following the format from the PR template. Add entries under the "Unreleased" section using the appropriate category (Added, Changed, Deprecated, Removed, Fixed, Security).
- PR links in CHANGELOG: Always use the format
[PR-XX](https://github.com/reductstore/reduct-js/pull/XX)where XX is the PR number. This should be added when the PR number is known (typically by the maintainer before merging). - Do not create examples for new features unless explicitly requested in the issue description.
- Do not update README unless explicitly requested in the issue description or necessary for the change.
- Always run formatter check (
npm run fmt:check) before committing changes. If formatting issues are found, runnpm run fmtto fix them automatically. - Always run linter (
npm run lint) before committing changes. If the linter fails with "command not found", ensure dependencies are properly installed withnpm install. - Verify CI checks: After pushing changes, monitor the CI pipeline to ensure all checks pass, including format, build, lint, and tests.
- Test with multiple ReductStore versions: Ensure changes work with both
reduct/store:main(new features) andreduct/store:latest(stable version) when testing locally.