Thank you for your interest in contributing to the Context-Action framework! This guide will help you get started with contributing to our TypeScript state management library.
- Node.js >= 18.0.0
- pnpm >= 8.0.0
# 1. Fork and clone the repository
git clone https://github.com/your-username/context-action.git
cd context-action
# 2. Install dependencies
pnpm install
# 3. Build all packages
pnpm build
# 4. Run tests to ensure everything works
pnpm test
# 5. Start development server
pnpm dev # Opens example app at http://localhost:5173- Search existing issues before creating a new one
- Use the bug report template with clear steps to reproduce
- Include TypeScript version and package versions
- Provide minimal reproduction using CodeSandbox or the example app
- Check the roadmap in discussions first
- Describe the problem you're trying to solve
- Propose a solution with examples
- Consider backwards compatibility
- Create an issue first to discuss the change
- Fork the repository and create a feature branch
- Follow our coding standards (see below)
- Add tests for new functionality
- Update documentation if needed
context-action/
βββ packages/
β βββ core/ # @context-action/core
β β βββ src/
β β β βββ ActionRegister.ts # Core action pipeline
β β β βββ action-guard.ts # Action guard system
β β β βββ types.ts # Type definitions
β β βββ __tests__/ # Unit tests
β β
β βββ react/ # @context-action/react
β β βββ src/
β β β βββ actions/ # Action context
β β β βββ stores/ # Store system
β β β β βββ core/ # Store implementation
β β β β βββ hooks/ # Store hooks
β β β β βββ patterns/ # Store patterns
β β β βββ index.ts
β β βββ __tests__/ # Integration tests
β β
β βββ llms-generator/ # Documentation tooling
β
βββ example/ # Example application
βββ docs/ # VitePress documentation
βββ scripts/ # Build scripts
- Strict TypeScript is enabled across all packages
- Explicit return types for all public functions
- JSDoc comments for all public APIs
- Generic constraints should be meaningful and documented
// β
Good
/**
* Creates a typed store context with reactive subscriptions
* @param name - Unique context name for debugging
* @param stores - Store definitions with initial values
* @returns Store context with Provider and hooks
*/
export function createStoreContext<T extends StoreMap>(
name: string,
stores: T
): StoreContextResult<T> {
// Implementation
}
// β Avoid
export function createStoreContext(name, stores) {
// Implementation
}- ESLint configuration is enforced in CI
- Prettier for consistent formatting
- 2 spaces for indentation
- Single quotes for strings
- Trailing commas where valid
- camelCase for functions and variables
- PascalCase for types, interfaces, and classes
- SCREAMING_SNAKE_CASE for constants
- Descriptive names over abbreviations
// β
Good
interface UserActionPayloadMap extends ActionPayloadMap {
updateUserProfile: { name: string; email: string };
deleteUserAccount: { userId: string };
}
const DEFAULT_STORE_OPTIONS: StoreOptions = {
immutable: true,
trackChanges: false
};
// β Avoid
interface UAP {
upd: { n: string; e: string };
}
const opts = { imm: true };- Unit tests for core functionality (
packages/*/src/**/*.test.ts) - Integration tests for React components (
packages/react/__tests__/) - E2E tests using the example application
- 100% coverage for core package critical paths
- Mock external dependencies appropriately
- Test both success and failure cases
- Use descriptive test names
// β
Good test structure
describe('ActionRegister', () => {
describe('register()', () => {
it('should register handler with correct priority', () => {
// Test implementation
});
it('should throw error when registering duplicate action', () => {
// Test implementation
});
it('should handle async handlers correctly', async () => {
// Test implementation
});
});
});# Run all tests
pnpm test
# Run tests for specific package
pnpm test:core
pnpm test:react
# Run tests in watch mode
cd packages/core && pnpm test:watch
# Run tests with coverage
pnpm test --coverage- JSDoc comments for all public APIs
- Type-first documentation - types should be self-documenting
- Examples in JSDoc for complex functions
- Clear examples with working code
- Progressive complexity - start simple, add complexity
- Real-world use cases over toy examples
- Both English and Korean versions when possible
- Automatically generated from TypeScript with TypeDoc
- Verify examples compile and run correctly
- Link to relevant guides and examples
feature/add-store-selectors
fix/action-handler-memory-leak
docs/improve-quick-start-guide
chore/update-dependenciesWe follow Conventional Commits:
feat(store): add computed store selector support
fix(react): resolve memory leak in action handlers
docs(readme): update quick start example
test(core): add action guard integration tests
chore(deps): update TypeScript to 5.3.2- Create feature branch from
main - Make changes following coding standards
- Add tests for new functionality
- Update documentation if needed
- Run full test suite and ensure all checks pass
- Create pull request using the PR template
- Address review feedback promptly
- Tests pass locally (
pnpm test) - Types check without errors (
pnpm type-check) - Linting passes (
pnpm lint) - Build succeeds (
pnpm build) - Documentation updated if needed
- Example app works if relevant (
pnpm dev)
We use Lerna for automated versioning and publishing:
# Version bump (maintainers only)
pnpm version:patch # 0.0.x
pnpm version:minor # 0.x.0
pnpm version:major # x.0.0
# Publish (maintainers only)
pnpm release- Automatically generated from conventional commits
- Manual enhancement for major releases
- Breaking changes clearly documented
- Migration guides for major versions
We are committed to providing a welcoming and inclusive experience for everyone. Please read and follow our Code of Conduct.
- GitHub Issues - Bug reports and feature requests
- GitHub Discussions - General questions and community discussion
- Pull Request Reviews - Technical discussions about code changes
- Check existing issues and discussions first
- Use issue templates for bug reports and features
- Provide minimal reproduction for bug reports
- Be patient and respectful in all interactions
Contributors are automatically recognized in:
- Release notes for significant contributions
- README contributors section (auto-generated)
- Package.json contributors field
Thank you for helping make Context-Action better! π
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Maintainer: @mineclover