Thank you for your interest in contributing to Solana Commerce Kit. This document provides guidelines for contributing to the project.
- Node.js 18 or higher
- pnpm 8 or higher
- Fork and clone the repository:
git clone https://github.com/your-username/commerce-kit.git
cd commerce-kit- Install dependencies:
pnpm install- Build all packages:
pnpm build- Run tests:
pnpm testcommerce-kit/
├── packages/
│ ├── solana-commerce/ # Meta-package
│ ├── react/ # React components
│ ├── sdk/ # React hooks
│ ├── headless/ # Core logic
│ ├── connector/ # Wallet connection
│ └── solana-pay/ # Solana Pay protocol
└── ...
Navigate to the package directory and use the development scripts:
cd packages/sdk
pnpm dev # Watch mode
pnpm test:watch # Test watch mode
pnpm type-check # Type checkingBuild individual packages:
cd packages/sdk
pnpm buildBuild all packages:
pnpm buildRun tests for a specific package:
cd packages/sdk
pnpm testRun all tests:
pnpm testBefore submitting a PR, ensure:
- All tests pass:
pnpm test - Code is formatted:
pnpm lint(if configured) - Code builds:
pnpm build
- Create a new branch:
git checkout -b feature/your-feature-name- Make your changes and commit:
git add .
git commit -m "Description of changes"- Push to your fork:
git push origin feature/your-feature-name- Open a pull request on GitHub
Write clear, descriptive commit messages.
- Follow TypeScript best practices
- Use meaningful variable and function names
- Add JSDoc comments for public APIs
- Keep functions focused and composable
When adding features:
- Add tests that cover the new functionality
- Update relevant README files
- Ensure TypeScript types are accurate
- Consider backward compatibility
If proposing breaking changes:
- Clearly document the rationale
- Provide migration path in PR description
- Update version appropriately (major version bump)
When adding or modifying features:
- Update package README with examples
- Add JSDoc comments to new APIs
- Include TypeScript type examples
- Place tests in
__tests__directories - Use descriptive test names
- Test both success and error cases
- Mock external dependencies appropriately
- Utilize the test style of the existing tests
Example:
import { describe, it, expect } from 'vitest';
describe('functionName', () => {
it('should handle valid input correctly', () => {
// Test implementation
});
it('should throw error for invalid input', () => {
// Test implementation
});
});- Open an issue for bug reports or feature requests
- Use discussions for questions about usage
- Check existing issues before creating new ones
By contributing, you agree that your contributions will be licensed under the MIT License.