-
Notifications
You must be signed in to change notification settings - Fork 0
docs: add CONTRIBUTING.md #56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
27Bslash6
wants to merge
1
commit into
main
Choose a base branch
from
docs/contributing
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+99
−0
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,99 @@ | ||
| # Contributing to cachekit-ts | ||
|
|
||
| Thanks for your interest. This project is in pre-1.0 development — see the [README](README.md#status) for what that means for stability. Bug reports, fixes, and well-scoped features are all welcome. | ||
|
|
||
| ## Quick setup | ||
|
|
||
| ```bash | ||
| pnpm install | ||
| pnpm build | ||
| pnpm test | ||
| ``` | ||
|
|
||
| Requirements: Node.js 22+, pnpm 8+, Rust stable (only needed if you touch `packages/cachekit-core-ts/`). | ||
|
|
||
| ## Pre-commit hooks | ||
|
|
||
| One-time setup per clone: | ||
|
|
||
| ```bash | ||
| prek install --install-hooks | ||
| ``` | ||
|
|
||
| Hooks run on every commit (ESLint + Prettier + actionlint + secret-scan + standard whitespace/yaml/json checks) and on every push (`pnpm type-check`). Falling back to Python `pre-commit` works identically against the same `.pre-commit-config.yaml`. | ||
|
|
||
| If you don't install the hooks, CI will catch the same things — just slower and noisier. | ||
|
|
||
| ## How to send a change | ||
|
|
||
| 1. **Open an issue first** for non-trivial work (anything beyond a typo or one-line fix). Saves both of us time if the direction is wrong. | ||
| 2. **Branch off `main`** — `main` is protected; you can't push to it directly. | ||
| 3. **Write a focused commit history** — small, reviewable commits. Don't squash exploratory work into one giant commit; we can squash on merge if it helps. | ||
| 4. **Open a PR** against `main`. CI must be green before merge. | ||
|
|
||
| ### Commit messages | ||
|
|
||
| We use [Conventional Commits](https://www.conventionalcommits.org/) because [release-please](https://github.com/googleapis/release-please) reads them to cut releases automatically. Releasing types: | ||
|
|
||
| | Type | When | Triggers release | | ||
| | -------------------------------------------------- | ----------------------------- | ---------------- | | ||
| | `feat:` | New user-facing functionality | Yes (minor) | | ||
| | `fix:` | User-facing bug fix | Yes (patch) | | ||
| | `perf:` | Performance improvement | Yes (patch) | | ||
| | `security:` | Security fix | Yes (patch) | | ||
| | `docs:` / `chore:` / `ci:` / `refactor:` / `test:` | Everything else | No | | ||
|
|
||
| Use the package directory as the scope when relevant: `feat(cachekit): ...` or `fix(cachekit-core-ts): ...`. | ||
|
|
||
| Breaking changes go in the commit body: | ||
|
|
||
| ``` | ||
| feat: rename createCache.minimal to createCache.fast | ||
|
|
||
| BREAKING CHANGE: createCache.minimal is now createCache.fast. | ||
| ``` | ||
|
|
||
| ## Running tests | ||
|
|
||
| ```bash | ||
| # All unit tests | ||
| pnpm test | ||
|
|
||
| # Single package | ||
| pnpm --filter @cachekit-io/cachekit test | ||
|
|
||
| # Integration tests (requires Docker for the Redis service container) | ||
| pnpm --filter @cachekit-io/cachekit test:integration | ||
|
|
||
| # Coverage | ||
| pnpm test:coverage | ||
| ``` | ||
|
|
||
| ## CI on external (fork) PRs | ||
|
|
||
| GitHub disables self-hosted runners for fork PRs by security policy. Our CI workflows detect this and fall back to `ubuntu-latest` automatically — no action needed on your side. The full job matrix runs identically; only the runner host differs. | ||
|
|
||
| ## What `main` looks like | ||
|
|
||
| `main` is the integration branch and is **not guaranteed stable between releases**. Per-PR CI only builds the native crate on linux-x64 to keep PR turnaround fast; the full 5-platform matrix (linux x64/arm64, macOS x86/arm64, Windows) runs on `push: main` and on release tags. Cross-platform regressions can land on `main` and stay there until the post-merge run catches them — they're always caught before a release tag is cut, so published artifacts on npm are always validated against every platform. | ||
|
|
||
| If you need stable, depend on a published version on npm. | ||
|
|
||
| ## Reporting bugs vs security issues | ||
|
|
||
| - **Bugs**: [open a GitHub issue](https://github.com/cachekit-io/cachekit-ts/issues/new) | ||
| - **Security vulnerabilities**: do NOT open a public issue. Use [GitHub's private vulnerability reporting](https://github.com/cachekit-io/cachekit-ts/security/advisories/new) or email security@cachekit.io. See [SECURITY.md](SECURITY.md) for the full policy. | ||
|
|
||
| ## Code style | ||
|
|
||
| The pre-commit hooks enforce most of it (ESLint + Prettier for TS, `cargo fmt`/`cargo clippy` for Rust). Beyond that: | ||
|
|
||
| - Type hints on all public APIs | ||
| - Guard clauses over nested conditionals | ||
| - No `any` without a comment justifying it | ||
| - Prefer absolute imports | ||
| - Tests live alongside source: `foo.ts` ↔ `foo.test.ts` | ||
|
|
||
| ## License | ||
|
|
||
| By contributing, you agree your work is licensed under the MIT License (see [LICENSE](LICENSE)). | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add language specifier to fenced code block.
The code block showing the breaking change format should include a language specifier for proper rendering and linting compliance.
📝 Proposed fix
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In
@CONTRIBUTING.mdaround lines 50 - 54, The fenced code block inCONTRIBUTING.md that shows the breaking change for createCache.minimal →
createCache.fast lacks a language specifier; update the triple-backtick fence
for that block to include a language (e.g., "text") so it renders and lints
properly (the block containing "feat: rename createCache.minimal to
createCache.fast" and "BREAKING CHANGE: createCache.minimal is now
createCache.fast.").