Thank you for your interest in contributing to rescript-signals! This document provides guidelines and instructions for contributing.
- Fork and clone the repository
- Install dependencies:
npm install
- Build the project:
npm run build
- Run tests:
npm test
This project follows Conventional Commits and enforces the 50/72 rule:
- Subject line: Maximum 50 characters
- Body lines: Maximum 72 characters per line
- Footer lines: Maximum 72 characters per line
Please read our Commit Convention Guide for detailed information.
<type>(<scope>): <subject>
<body>
<footer>
- feat: New feature (minor version bump)
- fix: Bug fix (patch version bump)
- perf: Performance improvement (patch version bump)
- refactor: Code refactoring (patch version bump)
- revert: Revert previous commit (patch version bump)
- docs: Documentation changes (no version bump)
- style: Code style changes (no version bump)
- test: Test changes (no version bump)
- build: Build system changes (no version bump)
- ci: CI changes (no version bump)
- chore: Other changes (no version bump)
For major version bumps, add BREAKING CHANGE: in the footer or ! after type:
feat!: remove deprecated API
BREAKING CHANGE: The old API has been completely removed.
Users should migrate to the new API.
When reporting bugs or issues:
- Provide a clear description of the problem
- Include a test case reproducing the issue if possible:
test("demonstrates the bug", () => { let signal = Signal.make(0) let computed = Computed.make(() => Signal.get(signal) * 2) Signal.set(signal, 5) // Expected: 10, Actual: 0 assertEqual(Signal.peek(computed), 10, ~message="Computed should update") })
- Describe the expected vs actual behavior
- Include relevant environment details if applicable
A reproducible test case helps us understand and fix the issue faster!
- Create a feature branch from
main - Make your changes
- Ensure all tests pass:
npm test - Ensure code builds:
npm run build - Commit using conventional commits
- Push to your fork
- Create a pull request
- All tests must pass
- All commits must follow conventional commit format
- Code must build successfully
- Include tests for new features or bug fixes
- Update documentation if needed
- Include test cases showing edge cases or scenarios that needed fixing (highly encouraged)
We use a simple custom test framework. Tests are located in the tests/ directory.
npm testSee existing tests in tests/ for examples:
open TestFramework
open Signals
let tests = suite(
"My Feature Tests",
[
test("should do something", () => {
let signal = Signal.make(42)
assertEqual(Signal.peek(signal), 42, ~message="Should equal 42")
}),
],
)When fixing bugs or adding features, include tests that demonstrate:
-
The specific scenario that was broken:
test("computed updates when last subscriber removed during rerun", () => { let base = Signal.make(0) let computed = Computed.make(() => Signal.get(base) * 2) let cleanup = ref(None) let _effect = Effect.make(() => { if Signal.get(base) > 5 { // Stop reading computed after base > 5 () } else { ignore(Signal.get(computed)) } }) Signal.set(base, 10) // Computed should be disposed here assertTrue(true, ~message="Should not crash on disposal") })
-
Boundary conditions: Empty inputs, zero values, maximum values
-
Error conditions: Invalid states, exceptions, resource cleanup
-
Race conditions: Concurrent updates, nested effects, reentrant calls
-
Performance considerations: Large data sets, deep nesting, many subscribers
Good test cases make the codebase more robust and prevent regressions!
Releases are automated using semantic-release:
- Commits to
maintrigger the release workflow - Semantic-release analyzes commit messages
- Version is bumped based on commit types
- CHANGELOG.md is updated
- Package is published to npm
- GitHub release is created
feat: Minor version bump (0.x.0)fix,perf,refactor,revert: Patch version bump (0.0.x)BREAKING CHANGE: Major version bump (x.0.0)docs,style,test,build,ci,chore: No version bump
- Follow existing code patterns
- Use ReScript best practices
- Keep functions small and focused
- Add comments for complex logic
Feel free to open an issue for any questions or concerns.